diff options
Diffstat (limited to 'test/tsohm.c')
-rw-r--r-- | test/tsohm.c | 1459 |
1 files changed, 721 insertions, 738 deletions
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 */ - |