diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-08-18 20:58:27 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-08-18 20:58:27 (GMT) |
commit | 28fa4fa8ee4d942a0d9f3343139d0da39a82c359 (patch) | |
tree | 0f615e6627801adeca9e6b5853532d6094722c43 /hl | |
parent | ec8b17858a79c9a90b990521a4b0345d7c74ad45 (diff) | |
download | hdf5-28fa4fa8ee4d942a0d9f3343139d0da39a82c359.zip hdf5-28fa4fa8ee4d942a0d9f3343139d0da39a82c359.tar.gz hdf5-28fa4fa8ee4d942a0d9f3343139d0da39a82c359.tar.bz2 |
Merge mostly whitespace changes from 1.10 branch
Diffstat (limited to 'hl')
-rw-r--r-- | hl/c++/test/ptableTest.cpp | 126 | ||||
-rw-r--r-- | hl/c++/test/ptableTest.h | 2 | ||||
-rw-r--r-- | hl/src/H5DO.c | 17 | ||||
-rw-r--r-- | hl/src/H5DS.c | 108 | ||||
-rw-r--r-- | hl/src/H5IM.c | 22 | ||||
-rw-r--r-- | hl/src/H5LT.c | 25 | ||||
-rw-r--r-- | hl/test/gen_test_ds.c | 10 | ||||
-rw-r--r-- | hl/test/h5hltest.h | 4 | ||||
-rw-r--r-- | hl/test/test_ds.c | 280 | ||||
-rw-r--r-- | hl/test/test_dset_opt.c | 36 | ||||
-rw-r--r-- | hl/test/test_file_image.c | 76 | ||||
-rw-r--r-- | hl/test/test_image.c | 112 | ||||
-rw-r--r-- | hl/test/test_lite.c | 213 | ||||
-rw-r--r-- | hl/test/test_packet.c | 30 | ||||
-rw-r--r-- | hl/test/test_packet_vlen.c | 827 | ||||
-rw-r--r-- | hl/test/test_table.c | 161 |
16 files changed, 1020 insertions, 1029 deletions
diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 340912e..e873503 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -36,22 +36,22 @@ int main(void) } else { - num_errors += BasicTest(); + num_errors += BasicTest(); - num_errors += TestCompoundDatatype(); + num_errors += TestCompoundDatatype(); - num_errors += TestGetPacket(); + num_errors += TestGetPacket(); - num_errors += TestGetNext(); + num_errors += TestGetNext(); - num_errors += TestCompress(); + num_errors += TestCompress(); - num_errors += TestErrors(); + num_errors += TestErrors(); - num_errors += SystemTest(); + num_errors += SystemTest(); - /* Test data corruption in packed structs */ - num_errors += TestHDFFV_9758(); + /* Test data corruption in packed structs */ + num_errors += TestHDFFV_9758(); /* Terminate access to the file. */ err = H5Fclose(fileID); @@ -81,7 +81,8 @@ int BasicTest() hsize_t count; int error; - TESTING("basic functionality") + printf("Testing %-62s", "basic functionality"); + HDfflush(stdout); FL_PacketTable wrapper(fileID, H5P_DEFAULT, BASICTEST_PT, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) @@ -137,7 +138,8 @@ int TestCompoundDatatype() hsize_t count; int error; - TESTING("compound datatypes") + printf("Testing %-62s", "compound datatypes"); + HDfflush(stdout); /* Create compound datatype */ typedef struct compoundType @@ -206,7 +208,8 @@ int TestGetNext() int records[2]; int i; - TESTING("GetNextPacket") + printf("Testing %-62s", "GetNextPacket"); + HDfflush(stdout); /* Create a dataset */ FL_PacketTable wrapper(fileID, H5P_DEFAULT, GETNEXT_PT, H5T_NATIVE_INT, 500); @@ -268,20 +271,21 @@ int TestCompress() unsigned int config = 0; size_t cd_nelemts = 0; - TESTING("compression") + printf("Testing %-62s", "compression"); + HDfflush(stdout); #ifdef H5_HAVE_FILTER_DEFLATE try { - /* Prepare property list to set compression, randomly use deflate */ - DSetCreatPropList dscreatplist; - dscreatplist.setDeflate(6); + /* Prepare property list to set compression, randomly use deflate */ + DSetCreatPropList dscreatplist; + dscreatplist.setDeflate(6); /* Create packet table with compression. */ FL_PacketTable wrapper(fileID, COMPRESS_PT, H5T_NATIVE_CHAR, 100, dscreatplist.getId()); - /* Close the property list */ - dscreatplist.close(); + /* Close the property list */ + dscreatplist.close(); - /* Verify that the deflate filter is set */ + /* Verify that the deflate filter is set */ /* Create an HDF5 C++ file object */ H5File file; @@ -293,10 +297,10 @@ int TestCompress() DSetCreatPropList dcpl = dset.getCreatePlist(); - char filter_name[8]; + char filter_name[8]; dcpl.getFilterById(H5Z_FILTER_DEFLATE, flags, cd_nelemts, NULL, 8, filter_name, config); - if (HDstrncmp(filter_name, "deflate", 7) != 0) - H5_FAILED() + if (HDstrncmp(filter_name, "deflate", 7) != 0) + H5_FAILED() } catch (Exception e) { H5_FAILED(); return 1; @@ -304,7 +308,7 @@ int TestCompress() PASSED(); #else SKIPPED(); - puts(" deflate filter not enabled"); + HDputs(" deflate filter not enabled"); #endif /* H5_HAVE_FILTER_DEFLATE */ return 0; } @@ -315,7 +319,8 @@ int TestGetPacket() int record; int theRecs[3]; int i; - TESTING("GetPacket") + printf("Testing %-62s", "GetPacket"); + HDfflush(stdout); /* Create a dataset. Does not need to specify property list because there is no compression. */ @@ -353,7 +358,8 @@ const char* PT_TESTERROR = "/TestErrors"; int TestErrors() { - TESTING("error conditions") + printf("Testing %-62s", "error conditions"); + HDfflush(stdout); /* Create a dataset */ FL_PacketTable wrapper(fileID, PT_TESTERROR, H5T_NATIVE_INT, 1); @@ -464,7 +470,8 @@ const char* PT_SYSTEMTST1 = "/SystemTest1"; const char* PT_SYSTEMTST2 = "/SystemTest2"; int SystemTest() { - TESTING("multiple datatypes") + printf("Testing %-62s", "multiple datatypes"); + HDfflush(stdout); hid_t dtypeID1, dtypeID2; hsize_t count; @@ -560,16 +567,16 @@ error: /*------------------------------------------------------------------------- * TestHDFFV_9758(): Test that a packet table with compound datatype which - * contains string type can be created and written correctly. (HDFFV-9758) + * contains string type can be created and written correctly. (HDFFV-9758) * * Notes: - * Previously, data of the field that follows the string was read back - * as garbage when #pragma pack(1) is used. + * Previously, data of the field that follows the string was read back + * as garbage when #pragma pack(1) is used. * 2016/10/20 -BMR * Updated: - * #pragma pack(1) caused failure on Emu because Sparc cannot - * access misaligned data. Changed it to pack() to do the - * default alignment. + * #pragma pack(1) caused failure on Emu because Sparc cannot + * access misaligned data. Changed it to pack() to do the + * default alignment. * 2016/10/25 -BMR *------------------------------------------------------------------------- */ @@ -592,57 +599,58 @@ int TestHDFFV_9758() }; s1_t s1[NUM_PACKETS]; - + for (hsize_t i = 0; i < NUM_PACKETS; i++) { s1[i].a = i; s1[i].b = 1.f * static_cast<float>(i * i); s1[i].c = 1. / (i + 1); - sprintf(s1[i].d, "string%d", (int)i); + HDsprintf(s1[i].d, "string%d", (int)i); s1[i].e = 100+i; } - TESTING("data corruption in packed structs (HDFFV-9758)") + printf("Testing %-62s", "data corruption in packed structs (HDFFV-9758)"); + HDfflush(stdout); // Build a compound datatype compound_type = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); if (compound_type < 0) - goto error; - + goto error; + err = H5Tinsert(compound_type, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT); if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT); if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); if (err < 0) - goto error; + goto error; strtype = H5Tcopy (H5T_C_S1); if (compound_type < 0) - goto error; + goto error; err = H5Tset_size (strtype, STRING_LENGTH); /* create string */ if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "d_name", HOFFSET(s1_t, d), strtype); if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "e_name", HOFFSET(s1_t, e), H5T_NATIVE_INT); if (err < 0) - goto error; + goto error; { // so ptable will go out of scope before PASSED // Create a packet table FL_PacketTable ptable(fileID, "/examplePacketTable", compound_type, 1); if (!ptable.IsValid()) - goto error; + goto error; // Add packets to the table for (size_t i = 0; i < NUM_PACKETS; i++) { - /* Appends one packet at the current position */ + /* Appends one packet at the current position */ err = ptable.AppendPacket(s1 + i); if (err < 0) goto error; } @@ -650,11 +658,11 @@ int TestHDFFV_9758() // Check packet count const hsize_t count = ptable.GetPacketCount(err); if (err < 0) - goto error; - + goto error; + if (count != NUM_PACKETS) { - std::cerr + std::cerr << "Number of packets in packet table should be " << NUM_PACKETS << " but is " << count << endl; } @@ -663,16 +671,16 @@ int TestHDFFV_9758() ptable.ResetIndex(); for (size_t i = 0; i < NUM_PACKETS; i++) { - s1_t s2; - memset(&s2, 0, sizeof(s1_t)); - err = ptable.GetNextPacket(&s2); - if (err < 0) - goto error; - - if (s2.a != s1[i].a || s2.e != s1[i].e) - goto error; - else if (HDstrcmp(s2.d, s1[i].d)) - goto error; + s1_t s2; + HDmemset(&s2, 0, sizeof(s1_t)); + err = ptable.GetNextPacket(&s2); + if (err < 0) + goto error; + + if (s2.a != s1[i].a || s2.e != s1[i].e) + goto error; + else if (HDstrcmp(s2.d, s1[i].d)) + goto error; } } // end of ptable block diff --git a/hl/c++/test/ptableTest.h b/hl/c++/test/ptableTest.h index 8af7bff..e1ba950 100644 --- a/hl/c++/test/ptableTest.h +++ b/hl/c++/test/ptableTest.h @@ -21,9 +21,9 @@ #ifndef PTABLETEST #define PTABLETEST +#include "h5hltest.h" #include "H5PacketTable.h" #include "H5Cpp.h" -#include "h5hltest.h" static hid_t fileID; diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c index f17e5d5..71dde78 100644 --- a/hl/src/H5DO.c +++ b/hl/src/H5DO.c @@ -11,11 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <string.h> -#include <stdlib.h> -#include <assert.h> -#include <stdio.h> - /* High-level library internal header file */ #include "H5HLprivate2.h" @@ -25,14 +20,11 @@ /*------------------------------------------------------------------------- - * Function: H5DOwrite_chunk + * Function: H5DOwrite_chunk * * Purpose: Writes an entire chunk to the file directly. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Raymond Lu - * 30 July 2012 + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -104,10 +96,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Matthew Strong (GE Healthcare) - * 14 February 2016 - * - *------------ ------------------------------------------------------------- + *--------------------------------------------------------------------------- */ herr_t H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 0778d3d..780b38d 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -241,7 +241,7 @@ herr_t H5DSattach_scale(hid_t did, if (has_dimlist == 0) { - dims[0] = (hsize_t)rank; + dims[0] = (hsize_t)rank; /* space for the attribute */ if((sid = H5Screate_simple(1, dims, NULL)) < 0) @@ -556,9 +556,9 @@ out: * * Date: December 20, 2004 * -* Comments: +* Comments: * -* Modifications: Function didn't delete DIMENSION_LIST attribute, when +* Modifications: Function didn't delete DIMENSION_LIST attribute, when * all dimension scales were detached from a dataset; added. * 2010/05/13 EIP * @@ -706,24 +706,24 @@ herr_t H5DSdetach_scale(hid_t did, /* same object, reset */ if(dsid_oi.fileno == tmp_oi.fileno && dsid_oi.addr == tmp_oi.addr) { - /* If there are more than one reference in the VL element + /* If there are more than one reference in the VL element and the reference we found is not the last one, copy the last one to replace the found one since the order - of the references doesn't matter according to the spec; - reduce the size of the VL element by 1; - if the length of the element becomes 0, free the pointer + of the references doesn't matter according to the spec; + reduce the size of the VL element by 1; + if the length of the element becomes 0, free the pointer and reset to NULL */ size_t len = buf[idx].len; - if(j < len - 1) - ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; + if(j < len - 1) + ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; len = --buf[idx].len; if(len == 0) { - HDfree(buf[idx].p); + HDfree(buf[idx].p); buf[idx].p = NULL; } - /* Since a reference to a dim. scale can be inserted only once, + /* Since a reference to a dim. scale can be inserted only once, we do not need to continue the search if it is found */ found_ds = 1; break; @@ -736,16 +736,16 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* Write the attribute, but check first, if we have any scales left, - because if not, we should delete the attribute according to the spec */ + because if not, we should delete the attribute according to the spec */ for(i = 0; i < rank; i++) { if(buf[i].len > 0) { have_ds = 1; - break; + break; } } - if(have_ds) { + if(have_ds) { if(H5Awrite(aid, tid, buf) < 0) - goto out; + goto out; } else { if(H5Adelete(did, DIMENSION_LIST) < 0) @@ -1123,7 +1123,7 @@ htri_t H5DSis_attached(hid_t did, if (dsbuf == NULL) goto out; - if (H5Aread(aid,ntid,dsbuf) < 0) + if (H5Aread(aid,ntid,dsbuf) < 0) goto out; /*------------------------------------------------------------------------- @@ -1445,7 +1445,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) if (H5I_DATASET != it) return FAIL; - if (label == NULL) + if (label == NULL) return FAIL; /* get dataset space */ @@ -1502,7 +1502,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; for (i = 0; i < (unsigned int) rank; i++) - u.const_buf[i] = NULL; + u.const_buf[i] = NULL; /* store the label information in the required index */ u.const_buf[idx] = label; @@ -1532,7 +1532,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) else { - + if ((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0) goto out; @@ -1541,7 +1541,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) /* allocate and initialize */ u.buf = (char **) HDmalloc((size_t) rank * sizeof(char *)); - + if (u.buf == NULL) goto out; @@ -1626,7 +1626,7 @@ out: * Comments: * * Modifications: -* JIRA HDFFV-7673: Added a check to see if the label name exists, +* JIRA HDFFV-7673: Added a check to see if the label name exists, * if not then returns zero. July 30, 2011. MSB * *------------------------------------------------------------------------- @@ -1714,26 +1714,26 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) if (buf[idx] != NULL) { /* get the real string length */ - nbytes = strlen(buf[idx]); + nbytes = HDstrlen(buf[idx]); - /* compute the string length which will fit into the user's buffer */ - copy_len = MIN(size-1, nbytes); + /* compute the string length which will fit into the user's buffer */ + copy_len = MIN(size-1, nbytes); - /* copy all/some of the name */ - if (label) - { - memcpy(label, buf[idx], copy_len); - - /* terminate the string */ - label[copy_len] = '\0'; - } + /* copy all/some of the name */ + if (label) + { + HDmemcpy(label, buf[idx], copy_len); + + /* terminate the string */ + label[copy_len] = '\0'; + } } /* free all the ptr's from the H5Aread() */ for (i = 0; i < rank; i++) { if (buf[i]) - HDfree(buf[i]); + HDfree(buf[i]); } /* close */ @@ -1867,7 +1867,7 @@ ssize_t H5DSget_scale_name(hid_t did, /* copy all/some of the name */ if (name) { - memcpy(name, buf, copy_len); + HDmemcpy(name, buf, copy_len); /* terminate the string */ name[copy_len]='\0'; @@ -1883,7 +1883,7 @@ ssize_t H5DSget_scale_name(hid_t did, if (buf) HDfree(buf); - return (ssize_t) MAX(0,nbytes-1); + return (ssize_t)(nbytes - 1); /* error zone */ out: @@ -1951,33 +1951,33 @@ htri_t H5DSis_scale(hid_t did) if((tid = H5Aget_type(aid)) < 0) goto out; - /* check to make sure attribute is a string */ - if(H5T_STRING != H5Tget_class(tid)) - goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(tid)) + goto out; - /* check to make sure string is null-terminated */ - if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) - goto out; + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) + goto out; - /* allocate buffer large enough to hold string */ - if((storage_size = H5Aget_storage_size(aid)) == 0) - goto out; + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; - buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); - if(buf == NULL) - goto out; + buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(buf == NULL) + goto out; - /* Read the attribute */ + /* Read the attribute */ if(H5Aread(aid, tid, buf) < 0) - goto out; + goto out; - /* compare strings */ + /* compare strings */ if(HDstrncmp(buf, DIMENSION_SCALE_CLASS, MIN(HDstrlen(DIMENSION_SCALE_CLASS),HDstrlen(buf)))==0) is_ds = 1; else is_ds = 0; - HDfree(buf); + HDfree(buf); if(H5Tclose(tid) < 0) goto out; @@ -2236,8 +2236,8 @@ out: static hid_t H5DS_get_REFLIST_type(void) { - hid_t ntid_t = -1; - + hid_t ntid_t = -1; + /* Build native type that corresponds to compound datatype used to store ds_list_t structure in the REFERENCE_LIST attribute */ @@ -2257,5 +2257,5 @@ out: H5Tclose(ntid_t); } H5E_END_TRY; return FAIL; -} +} diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index f76f029..18aa133 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -250,12 +250,12 @@ herr_t H5IMget_image_info( hid_t loc_id, char *interlace, hssize_t *npals ) { - hid_t did; - hid_t sid; + hid_t did = -1; + hid_t sid = -1; hsize_t dims[IMAGE24_RANK]; - hid_t aid; - hid_t asid; - hid_t atid; + hid_t aid = -1; + hid_t asid = -1; + hid_t atid = -1; H5T_class_t aclass; int has_pal; int has_attr; @@ -391,10 +391,14 @@ herr_t H5IMget_image_info( hid_t loc_id, return 0; out: - H5Dclose( did ); - H5Aclose( aid ); - H5Sclose( asid ); - H5Tclose( atid ); + if(did > 0) + H5Dclose( did ); + if(aid > 0) + H5Aclose( aid ); + if(asid > 0) + H5Sclose( asid ); + if(atid > 0) + H5Tclose( atid ); return -1; } diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index a9db3b4..0074d02 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -11,13 +11,12 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <string.h> -#include <stdlib.h> #include <assert.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "H5LTprivate.h" -#include "H5private.h" /* For Lex and Yacc */ #define COL 3 @@ -865,13 +864,13 @@ out: */ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) { - hid_t fapl, file_id; /* HDF5 identifiers */ - unsigned file_open_flags;/* Flags for image open */ - char file_name[64]; /* Filename buffer */ - size_t alloc_incr; /* Buffer allocation increment */ - size_t min_incr = 65536; /* Minimum buffer increment */ - double buf_prcnt = 0.1f; /* Percentage of buffer size to set - as increment */ + hid_t fapl=-1, file_id=-1; /* HDF5 identifiers */ + unsigned file_open_flags; /* Flags for image open */ + char file_name[64]; /* Filename buffer */ + size_t alloc_incr; /* Buffer allocation increment */ + size_t min_incr = 65536; /* Minimum buffer increment */ + double buf_prcnt = 0.1f; /* Percentage of buffer size to set + as increment */ static long file_name_counter; H5FD_file_image_callbacks_t callbacks = {&image_malloc, &image_memcpy, &image_realloc, &image_free, @@ -893,8 +892,8 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) /* set allocation increment to a percentage of the supplied buffer size, or * a pre-defined minimum increment value, whichever is larger */ - if ((buf_prcnt * buf_size) > min_incr) - alloc_incr = (size_t)(buf_prcnt * buf_size); + if ((size_t)(buf_prcnt * (double)buf_size) > min_incr) + alloc_incr = (size_t)(buf_prcnt * (double)buf_size); else alloc_incr = min_incr; @@ -3356,7 +3355,7 @@ herr_t H5LTget_attribute_long( hid_t loc_id, * * Date: June 17, 2005 * -* Comments: This funstion was added to suuport INTEGER*8 Fortran types +* Comments: This function was added to support INTEGER*8 Fortran types * * Modifications: * diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c index f8f1d39..273e393 100644 --- a/hl/test/gen_test_ds.c +++ b/hl/test/gen_test_ds.c @@ -281,7 +281,7 @@ static int test_long_attachscales(const char *filename) strcpy(dsname, DATASET_NAME); strcat(dsname, "al"); - TESTING2("test_long_attachscales"); + HL_TESTING2("test_long_attachscales"); if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto out; @@ -342,7 +342,7 @@ static int test_duplicatelong_attachscales(const char *filename) strcpy(dsname, DATASET_NAME); strcat(dsname, "al2"); - TESTING2("test_duplicatelong_attachscales"); + HL_TESTING2("test_duplicatelong_attachscales"); if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto out; @@ -406,7 +406,7 @@ static int test_long_scalenames(const char *filename) { if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto out; - TESTING2("set long scale/cmp scale name"); + HL_TESTING2("set long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { strcpy(scalename, DS_1_NAME); strcat(scalename, "al"); @@ -483,7 +483,7 @@ static int test_samelong_scalenames(const char *filename) { if((fid = open_test_file(filename)) < 0) goto out; - TESTING2("set same long scale/cmp scale name"); + HL_TESTING2("set same long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { strcpy(scalename, DS_1_NAME); strcat(scalename, "al"); @@ -554,7 +554,7 @@ static int test_foreign_scaleattached(const char *filename) hid_t did = -1; hid_t dsid = -1; - TESTING2("test_foreign_scaleattached"); + HL_TESTING2("test_foreign_scaleattached"); if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto out; diff --git a/hl/test/h5hltest.h b/hl/test/h5hltest.h index f368b8e..85f47bd 100644 --- a/hl/test/h5hltest.h +++ b/hl/test/h5hltest.h @@ -28,8 +28,8 @@ #include "H5HLprivate2.h" /* Macros used in HL tests */ -#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);} -#define TESTING3(WHAT) {printf("%-70s", "" WHAT); fflush(stdout);} +#define HL_TESTING2(WHAT) {HDprintf("Testing %-62s", WHAT); HDfflush(stdout);} +#define HL_TESTING3(WHAT) {HDprintf("Testing %-62s", WHAT); HDfflush(stdout);} /* Implements verbose 'assert' with 'goto error' exit */ #define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0) diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index f2d4b8f..9389a0d 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -387,7 +387,7 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int int rank = 4; int rankds = 1; hsize_t dims[4] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE,DIM4_SIZE}; - long buf[DIM1_SIZE*DIM2_SIZE*DIM3_SIZE*DIM4_SIZE]; + long *buf; hsize_t s1_dim[1] = {DIM1_SIZE}; hsize_t s2_dim[1] = {DIM2_SIZE}; hsize_t s3_dim[1] = {DIM3_SIZE}; @@ -407,6 +407,10 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int long s43_wbuf[DIM4_SIZE] = {180,180}; long s44_wbuf[DIM4_SIZE] = {280,280}; + /* Allocate buffer */ + if(NULL == (buf = (long *)HDmalloc(sizeof(long) * DIM1_SIZE * DIM2_SIZE * DIM3_SIZE * DIM4_SIZE))) + return FAIL; + /* make a dataset */ if(H5LTmake_dataset_long(fid, dsname, rank, dims, buf) >= 0) { if(fulldims==0) { @@ -442,6 +446,9 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int } else return FAIL; + + HDfree(buf); + return SUCCEED; } @@ -1103,10 +1110,10 @@ herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *sc if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) { if(H5DSis_attached(did, dsid, idx) == 1) { if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) { - name_out = (char*)HDmalloc((name_len+1) * sizeof (char)); + name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char)); if(name_out != NULL) { if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) >= 0) { - if(HDstrcmp(scalename,name_out)==0) { + if(HDstrncmp(scalename, name_out, (size_t)name_len)==0) { ret_value = SUCCEED; } HDfree(name_out); @@ -1139,7 +1146,7 @@ static int test_detachscales(void) and detach them to check that at the end there is no attributes REFERENCE_LIST on a dimension scale and DIMENSION_LIST on a dataset */ - TESTING2("test_detachscales"); + HL_TESTING2("test_detachscales"); if((fid = H5Fcreate("test_detach.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; @@ -1273,7 +1280,7 @@ static int test_char_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "ac"); - TESTING2("test_char_attachscales"); + HL_TESTING2("test_char_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1326,7 +1333,7 @@ static int test_short_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "as"); - TESTING2("test_short_attachscales"); + HL_TESTING2("test_short_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1403,7 +1410,7 @@ static int test_int_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "a"); - TESTING2("test_int_attachscales"); + HL_TESTING2("test_int_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1464,7 +1471,7 @@ static int test_long_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "al"); - TESTING2("test_long_attachscales"); + HL_TESTING2("test_long_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1521,7 +1528,7 @@ static int test_duplicatelong_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "al2"); - TESTING2("test_duplicatelong_attachscales"); + HL_TESTING2("test_duplicatelong_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1578,7 +1585,7 @@ static int test_float_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "af"); - TESTING2("test_float_attachscales"); + HL_TESTING2("test_float_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1640,7 +1647,7 @@ static int test_numberofscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "a"); - TESTING2("test_numberofscales"); + HL_TESTING2("test_numberofscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1722,7 +1729,7 @@ static int test_char_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set char scale/cmp scale name"); + HL_TESTING2("set char scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "ac"); HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "ac"); @@ -1782,7 +1789,7 @@ static int test_short_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set short scale/cmp scale name"); + HL_TESTING2("set short scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "as"); HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "as"); @@ -1890,7 +1897,7 @@ static int test_int_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set int scale/cmp scale name"); + HL_TESTING2("set int scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "a"); HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "a"); @@ -1966,7 +1973,7 @@ static int test_long_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set long scale/cmp scale name"); + HL_TESTING2("set long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "al"); HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "al"); @@ -2034,7 +2041,7 @@ static int test_samelong_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set same long scale/cmp scale name"); + HL_TESTING2("set same long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "al"); HDsnprintf(name, sizeof(name), "%s%s", DS_1_NAME, "al"); @@ -2102,7 +2109,7 @@ static int test_float_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set float scale/cmp scale name"); + HL_TESTING2("set float scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "af"); HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "af"); @@ -2172,17 +2179,9 @@ static int test_foreign_scaleattached(const char *fileforeign) hid_t fid = -1; hid_t did = -1; hid_t dsid = -1; - char *srcdir = getenv("srcdir"); /* the source directory */ - char filename[512]=""; /* buffer to hold name of existing file */ + const char *filename = H5_get_srcdir_filename(fileforeign); - /* compose the name of the file to open, using the srcdir, if appropriate */ - if (srcdir) { - HDstrcpy(filename,srcdir); - HDstrcat(filename,"/"); - } - HDstrcat(filename, fileforeign); - - TESTING2("test_foreign_scaleattached"); + HL_TESTING2("test_foreign_scaleattached"); if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto out; @@ -2427,7 +2426,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - TESTING2("detach scales "); + HL_TESTING2("detach scales "); /*------------------------------------------------------------------------- @@ -3014,7 +3013,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - TESTING2("set/get label"); + HL_TESTING2("set/get label"); if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; @@ -3104,7 +3103,7 @@ static int test_simple(void) */ - TESTING2("set scale/get scale name"); + HL_TESTING2("set scale/get scale name"); if((dsid = H5Dopen2(fid,"ds_a_1", H5P_DEFAULT)) < 0) goto out; if(H5DSset_scale(dsid,"Latitude set 0") < 0) @@ -3124,7 +3123,7 @@ static int test_simple(void) goto out; /* allocate a buffer */ - name_out = (char*)HDmalloc((name_len+1) * sizeof (char)); + name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char)); if(name_out == NULL) goto out; @@ -3206,7 +3205,7 @@ static int test_simple(void) */ - TESTING2("iterate scales"); + HL_TESTING2("iterate scales"); /*------------------------------------------------------------------------- @@ -3772,7 +3771,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("attach a dataset to itself"); + HL_TESTING2("attach a dataset to itself"); if(H5DSattach_scale(did, did, 0) == SUCCEED) goto out; @@ -3783,7 +3782,7 @@ static int test_errors(void) * attempt to attach a group with a dataset, it should fail *------------------------------------------------------------------------- */ - TESTING2("attach a group with a dataset"); + HL_TESTING2("attach a group with a dataset"); if(H5DSattach_scale(gid,dsid,0)==SUCCEED) goto out; @@ -3794,7 +3793,7 @@ static int test_errors(void) * attempt to attach a dataset with a group, it should fail *------------------------------------------------------------------------- */ - TESTING2("attach a dataset with a group"); + HL_TESTING2("attach a dataset with a group"); if(H5DSattach_scale(did,gid,0)==SUCCEED) goto out; @@ -3805,7 +3804,7 @@ static int test_errors(void) * attempt to set scale for a group, it should fail *------------------------------------------------------------------------- */ - TESTING2("set scale for a group"); + HL_TESTING2("set scale for a group"); if(H5DSset_scale(gid,"scale 1")==SUCCEED) goto out; @@ -3835,7 +3834,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("attach a scale that has scales"); + HL_TESTING2("attach a scale that has scales"); /* create the data space for the scale */ if((sidds = H5Screate_simple(rankds, s1_dim, NULL)) < 0) @@ -3904,7 +3903,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("attach to a dataset that is a scale"); + HL_TESTING2("attach to a dataset that is a scale"); /* open the previous written "ds_b", that is a scale */ if((dsid = H5Dopen2(fid,"ds_b", H5P_DEFAULT)) < 0) @@ -3931,7 +3930,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("attach to a dataset that is a reserved class dataset"); + HL_TESTING2("attach to a dataset that is a reserved class dataset"); /* make an image */ if(H5IMmake_image_8bit(fid,"image",(hsize_t)100,(hsize_t)50,NULL) < 0) @@ -3966,7 +3965,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("is scale"); + HL_TESTING2("is scale"); /* open a non scale dataset */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4000,7 +3999,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("detach scale from dataset it is not attached to"); + HL_TESTING2("detach scale from dataset it is not attached to"); /* open the previous written "ds_a" */ if((dsid = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0) @@ -4028,7 +4027,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("detach scale from group"); + HL_TESTING2("detach scale from group"); /* open the previous written "ds_a" */ if((dsid = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0) @@ -4056,7 +4055,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("detach scale when scale is group"); + HL_TESTING2("detach scale when scale is group"); /* open the previous written "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4148,7 +4147,7 @@ static int test_iterators(void) *------------------------------------------------------------------------- */ - TESTING2("iterate when the dataset has no scales "); + HL_TESTING2("iterate when the dataset has no scales "); /* get the dataset id for "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4170,7 +4169,7 @@ static int test_iterators(void) *------------------------------------------------------------------------- */ - TESTING2("iterate on dimension that is outside the rank "); + HL_TESTING2("iterate on dimension that is outside the rank "); /* get the dataset id for "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4191,7 +4190,7 @@ static int test_iterators(void) *------------------------------------------------------------------------- */ - TESTING2("iterate for dimension with many scales "); + HL_TESTING2("iterate for dimension with many scales "); /* open the previously written "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4228,7 +4227,7 @@ static int test_iterators(void) *------------------------------------------------------------------------- */ - TESTING2("iterate on group "); + HL_TESTING2("iterate on group "); /* open */ if((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0) @@ -4250,7 +4249,7 @@ static int test_iterators(void) *------------------------------------------------------------------------- */ - TESTING2("iterate in deleted scales "); + HL_TESTING2("iterate in deleted scales "); if(H5Ldelete(fid, "ds_0", H5P_DEFAULT) < 0) goto out; @@ -4344,7 +4343,7 @@ static int test_rank(void) *------------------------------------------------------------------------- */ - TESTING2("attach"); + HL_TESTING2("attach"); if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; @@ -4372,7 +4371,7 @@ static int test_rank(void) *------------------------------------------------------------------------- */ - TESTING2("detach"); + HL_TESTING2("detach"); if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; @@ -4398,7 +4397,7 @@ static int test_rank(void) *------------------------------------------------------------------------- */ - TESTING2("attach, set, get names, labels"); + HL_TESTING2("attach, set, get names, labels"); if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; @@ -4437,7 +4436,7 @@ static int test_rank(void) *------------------------------------------------------------------------- */ - TESTING2("attach a scalar scale"); + HL_TESTING2("attach a scalar scale"); /* create the data space for the dataset */ if((sid = H5Screate_simple(2, dimss, NULL)) < 0) @@ -4550,7 +4549,7 @@ static int test_types(void) *------------------------------------------------------------------------- */ - TESTING2("floating point and short scales"); + HL_TESTING2("floating point and short scales"); /* get the dataset id for "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4613,7 +4612,7 @@ static int test_types(void) *------------------------------------------------------------------------- */ - TESTING2("string scales"); + HL_TESTING2("string scales"); /* get the dataset id for "dset_b" */ if((did = H5Dopen2(fid,"dset_b", H5P_DEFAULT)) < 0) @@ -4710,7 +4709,7 @@ static int test_data(void) *------------------------------------------------------------------------- */ - TESTING2("generating scales"); + HL_TESTING2("generating scales"); /*------------------------------------------------------------------------- * create datasets: 1 "data" dataset and 2 dimension scales @@ -4866,18 +4865,9 @@ static int read_data( const char* fname, size_t nelms; FILE *f; float val; - char *srcdir = getenv("srcdir"); /* the source directory */ - char data_file[512]; /* buffer to hold name of existing data file */ - - HDstrcpy(data_file, ""); - /* compose the name of the file to open, using the srcdir, if appropriate */ - if(srcdir) { - HDstrcpy(data_file, srcdir); - HDstrcat(data_file, "/"); - } - /* read first data file */ - HDstrcat(data_file,fname); + const char *data_file = H5_get_srcdir_filename(fname); + /* read first data file */ f = HDfopen(data_file, "r"); if( f == NULL ) { printf( "Could not open file %s\n", data_file ); @@ -4885,22 +4875,34 @@ static int read_data( const char* fname, } for(i=0, nelms=1; i < ndims; i++) { - fscanf( f, "%s %u", str, &j); - fscanf( f, "%d",&n ); + if(fscanf( f, "%s %u", str, &j) && HDferror(f)) { + HDprintf( "fscanf error in file %s\n", data_file ); + HDfclose(f); + return -1; + } /* end if */ + if(fscanf( f, "%d",&n ) < 0 && HDferror(f)) { + HDprintf( "fscanf error in file %s\n", data_file ); + HDfclose(f); + return -1; + } /* end if */ dims[i] = (hsize_t)n; nelms *= (size_t)n; } *buf = (float*) HDmalloc (nelms * sizeof( float )); - if (*buf == NULL) { + if ( *buf == NULL ) { printf( "memory allocation failed\n" ); HDfclose(f); return -1; } for(j = 0; j < nelms; j++) { - fscanf( f, "%f",&val ); + if(fscanf( f, "%f",&val ) < 0 && HDferror(f)) { + HDprintf( "fscanf error in file %s\n", data_file ); + HDfclose(f); + return -1; + } /* end if */ (*buf)[j] = val; } HDfclose(f); @@ -4952,7 +4954,7 @@ static int test_errors2(void) goto out; - TESTING2("attach scales"); + HL_TESTING2("attach scales"); /*------------------------------------------------------------------------- @@ -4975,7 +4977,7 @@ static int test_errors2(void) PASSED(); - TESTING2("detach scales"); + HL_TESTING2("detach scales"); /*------------------------------------------------------------------------- * detach with invalid indices @@ -4996,7 +4998,7 @@ static int test_errors2(void) PASSED(); - TESTING2("set/get label"); + HL_TESTING2("set/get label"); /*------------------------------------------------------------------------- * set/get label invalid indices @@ -5012,7 +5014,7 @@ static int test_errors2(void) goto out; if ((label_len=H5DSget_label(did,0,NULL,0)) < 0) goto out; - if (label_len != HDstrlen("label")) + if ( label_len != HDstrlen("label") ) goto out; if (H5DSget_label(did,0,lbuf,sizeof(lbuf)) < 0) goto out; @@ -5021,7 +5023,7 @@ static int test_errors2(void) PASSED(); - TESTING2("iterate scales"); + HL_TESTING2("iterate scales"); /*------------------------------------------------------------------------- @@ -5120,131 +5122,131 @@ static int test_attach_detach(void) hid_t var1_id, var2_id, var3_id; /* DS component name */ hsize_t dims[RANK1] = {DIM1}; - TESTING2("permutations of attaching and detaching"); + HL_TESTING2("permutations of attaching and detaching"); if((fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + goto out; if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) - goto out; + goto out; /* Create dimension scale. */ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; + goto out; if((sid = H5Screate_simple(1, dims, dims)) < 0) - goto out; + goto out; if((dsid = H5Dcreate2(gid, DS_3_NAME, H5T_IEEE_F32BE, sid, - H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) - goto out; + H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto out; if(H5Sclose(sid) < 0) - goto out; + goto out; if(H5Pclose(dcpl_id) < 0) - goto out; + goto out; if(H5DSset_scale(dsid, DS_3_NAME) < 0) - goto out; + goto out; /* Create a variable that uses this dimension scale. */ if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) - goto out; + goto out; if((var1_id = H5Dcreate2(gid, DS_31_NAME, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + goto out; if(H5Sclose(sid) < 0) - goto out; + goto out; if(H5DSattach_scale(var1_id, dsid, 0) < 0) - goto out; + goto out; /* Create another variable that uses this dimension scale. */ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; + goto out; if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) - goto out; + goto out; if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) - goto out; + goto out; if((var2_id = H5Dcreate2(gid, DS_32_NAME, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) - goto out; + goto out; if(H5Pclose(dcpl_id) < 0) - goto out; + goto out; if(H5Sclose(sid) < 0) - goto out; + goto out; /* Create 3rd variable that uses this dimension scale. */ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; + goto out; if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) - goto out; + goto out; if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) - goto out; + goto out; if((var3_id = H5Dcreate2(gid, DS_33_NAME, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) - goto out; + goto out; if(H5Pclose(dcpl_id) < 0) - goto out; + goto out; if(H5Sclose(sid) < 0) - goto out; + goto out; /* Attached var2 scale */ if(H5DSattach_scale(var2_id, dsid, 0) < 0) - goto out; + goto out; /* Detach the var2 scale */ if(H5DSdetach_scale(var2_id, dsid, 0) < 0) - goto out; + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; /* Detach the var1 scale */ if(H5DSdetach_scale(var1_id, dsid, 0) < 0) - goto out; + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; /* Attach the DS again and remove them in the opposite order */ if(H5DSattach_scale(var1_id, dsid, 0) < 0) - goto out; + goto out; if(H5DSattach_scale(var2_id, dsid, 0) < 0) - goto out; + goto out; /* Detach the var1 scale */ if(H5DSdetach_scale(var1_id, dsid, 0) < 0) - goto out; + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) == 0) /* should still be attached */ - goto out; + goto out; /* Detach the var2 scale */ if(H5DSdetach_scale(var2_id, dsid, 0) < 0) @@ -5252,60 +5254,60 @@ static int test_attach_detach(void) /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; /*************************************************** * Attach Three DS and remove the middle one first *****************************************************/ if(H5DSattach_scale(var1_id, dsid, 0) < 0) - goto out; + goto out; if(H5DSattach_scale(var2_id, dsid, 0) < 0) - goto out; + goto out; if(H5DSattach_scale(var3_id, dsid, 0) < 0) - goto out; + goto out; /* Detach the var2 scale */ if(H5DSdetach_scale(var2_id, dsid, 0) < 0) - goto out; + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var3_id, dsid, 0) == 0) /* should still be attached */ - goto out; + goto out; /* Detach the var3 scale */ if(H5DSdetach_scale(var3_id, dsid, 0) < 0) - goto out; + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; /* Detach the var1 scale */ if(H5DSdetach_scale(var1_id, dsid, 0) < 0) - goto out; + goto out; /* Check if in correct state of detached and attached */ if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; if(H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */ - goto out; + goto out; /*------------------------------------------------------------------------- * close @@ -5313,17 +5315,17 @@ static int test_attach_detach(void) */ if(H5Dclose(var1_id) < 0) - goto out; + goto out; if(H5Dclose(var2_id) < 0) - goto out; + goto out; if(H5Dclose(var3_id) < 0) - goto out; + goto out; if(H5Dclose(dsid) < 0) - goto out; + goto out; if(H5Gclose(gid) < 0) - goto out; + goto out; if(H5Fclose(fid) < 0) - goto out; + goto out; PASSED(); @@ -5333,9 +5335,9 @@ static int test_attach_detach(void) out: H5E_BEGIN_TRY { - H5Dclose(var1_id); - H5Dclose(var2_id); - H5Dclose(var3_id); + H5Dclose(var1_id); + H5Dclose(var2_id); + H5Dclose(var3_id); H5Dclose(dsid); H5Gclose(gid); H5Fclose(fid); diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c index fac2e89..f4183c8 100644 --- a/hl/test/test_dset_opt.c +++ b/hl/test/test_dset_opt.c @@ -153,7 +153,7 @@ test_direct_chunk_write (hid_t file) hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - TESTING("basic functionality of H5DOwrite_chunk"); + HL_TESTING2("basic functionality of H5DOwrite_chunk"); /* * Create the data space with unlimited dimensions. @@ -399,7 +399,7 @@ test_direct_chunk_overwrite_data(hid_t fid) int16_t n; int16_t read_buf[OVERWRITE_CHUNK_NY][OVERWRITE_CHUNK_2NX]; - TESTING("overwriting existing data with H5DOwrite_chunk"); + HL_TESTING2("overwriting existing data with H5DOwrite_chunk"); /* Create the dataset's data space */ if ((sid = H5Screate_simple(OVERWRITE_NDIMS, dset_dims, dset_max_dims)) < 0) @@ -473,7 +473,7 @@ error: } /* end test_direct_chunk_overwrite_data() */ /*------------------------------------------------------------------------- - * Function: test_skip_compress_write1 + * Function: test_skip_compress_write1 * * Purpose: Test skipping compression filter when it is the only filter * for the dataset @@ -514,7 +514,7 @@ test_skip_compress_write1(hid_t file) hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - TESTING("skipping compression filter for H5DOwrite_chunk/H5DOread_chunk"); + HL_TESTING2("skipping compression filter for H5DOwrite_chunk/H5DOread_chunk"); /* * Create the data space with unlimited dimensions. @@ -767,7 +767,7 @@ test_skip_compress_write2(hid_t file) hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - TESTING("skipping compression filters but keep two other filters"); + HL_TESTING2("skipping compression filters but keep two other filters"); /* * Create the data space with unlimited dimensions. @@ -968,7 +968,7 @@ test_data_conv(hid_t file) hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - TESTING("data conversion for H5DOwrite_chunk/H5DOread_chunk"); + HL_TESTING2("data conversion for H5DOwrite_chunk/H5DOread_chunk"); /* * Create the data space with unlimited dimensions. @@ -1181,7 +1181,7 @@ test_invalid_parameters(hid_t file) hsize_t chunk_nbytes; /* Chunk size */ - TESTING("invalid parameters for H5DOwrite_chunk/H5DOread_chunk"); + HL_TESTING2("invalid parameters for H5DOwrite_chunk/H5DOread_chunk"); /* * Create the data space with unlimited dimensions. @@ -1408,7 +1408,7 @@ test_direct_chunk_read_no_cache (hid_t file) hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - TESTING("basic functionality of H5DOread_chunk (chunk cache disabled)"); + HL_TESTING2("basic functionality of H5DOread_chunk (chunk cache disabled)"); /* Create the data space with unlimited dimensions. */ if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) @@ -1578,9 +1578,9 @@ test_direct_chunk_read_cache (hid_t file, hbool_t flush) hsize_t block[2]; /* Block sizes */ if(flush) { - TESTING("basic functionality of H5DOread_chunk (flush chunk cache)"); + HL_TESTING2("basic functionality of H5DOread_chunk (flush chunk cache)"); } else { - TESTING("basic functionality of H5DOread_chunk (does not flush chunk cache)"); + HL_TESTING2("basic functionality of H5DOread_chunk (does not flush chunk cache)"); } /* Create the data space with unlimited dimensions. */ @@ -1760,7 +1760,7 @@ test_read_unfiltered_dset(hid_t file) hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - TESTING("basic functionality of H5DOread_chunk on unfiltered datasets"); + HL_TESTING2("basic functionality of H5DOread_chunk on unfiltered datasets"); /* Create the data space with unlimited dimensions. */ if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) @@ -1902,7 +1902,7 @@ test_read_unallocated_chunk (hid_t file) int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5DOread and manually decompressed */ hsize_t offset[2]; /* chunk offset used for H5DOread_chunk */ - TESTING("H5DOread_chunk with unallocated chunks"); + HL_TESTING2("H5DOread_chunk with unallocated chunks"); /* Create the data space with unlimited dimensions. */ if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) @@ -2015,7 +2015,7 @@ test_single_chunk(unsigned config) int rdata[DIM0][DIM1]; /* Read buffer */ int i, j; /* Local index variable */ - TESTING("Single chunk I/O"); + HL_TESTING2("Single chunk I/O"); /* Initialize data */ for (i=0; i<DIM0; i++) { @@ -2133,15 +2133,15 @@ error: } /* test_single_chunk_latest() */ /*------------------------------------------------------------------------- - * Function: Main function + * Function: Main function * - * Purpose: Test direct chunk write function H5Dwrite_chunk and + * Purpose: Test direct chunk write function H5Dwrite_chunk and * chunk direct read function H5Dread_chunk * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 30 November 2012 * *------------------------------------------------------------------------- diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index 0f079ca..5297e61 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -38,7 +38,7 @@ extend the image, and then performs writes that extend the images. The fifth loop reads the extended images and verify that the content are correct. The sixth and final loop closes the file images and deallocates the image - buffers if appropriate. */ + buffers if appropriate. */ /*------------------------------------------------------------------------- * test file image operations @@ -61,11 +61,11 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) void **buf_ptr; /* pointer to array of pointers to image buffers */ char **filename; /* pointer to array of pointers to filenames */ unsigned *input_flags; /* pointer to array of flag combinations */ - size_t i, j, k, nrow, n_values; + size_t i, j, k, nrow, n_values; herr_t status1; void *handle_ptr = NULL; /* pointers to driver buffer */ - unsigned char **core_buf_ptr_ptr = NULL; - + unsigned char **core_buf_ptr_ptr = NULL; + VERIFY(open_images > 1 , "The number of open images must be greater than 1"); VERIFY(nflags > 0, "The number of flag combinations must be greater than 0"); @@ -94,7 +94,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) if (NULL == (dset_id = (hid_t *)HDmalloc(sizeof(hid_t) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); - TESTING("get file images"); + HL_TESTING2("get file images"); /* create several file images */ for (i = 0; i < open_images; i++) { @@ -112,11 +112,11 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) if ((file_id[i] = H5Fcreate(filename[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_PUTS_ERROR("H5Fcreate() failed"); - /* define dataspace for the dataset */ - if ((file_space = H5Screate_simple(RANK, dims1, max_dims)) < 0) + /* define dataspace for the dataset */ + if ((file_space = H5Screate_simple(RANK, dims1, max_dims)) < 0) FAIL_PUTS_ERROR("H5Screate_simple() failed"); - /* create dataset property list */ + /* create dataset property list */ if ((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_PUTS_ERROR("H5Pcreate() failed"); @@ -127,8 +127,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* create and write an integer type dataset named "dset" */ if ((dset_id[i] = H5Dcreate2(file_id[i], DSET_NAME, H5T_NATIVE_INT, file_space, H5P_DEFAULT, plist, H5P_DEFAULT)) < 0) FAIL_PUTS_ERROR("H5Dcreate() failed"); - - /* dataset in open image 1 is written with "wrong" data */ + + /* dataset in open image 1 is written with "wrong" data */ if (i == 1) { if (H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2) < 0) FAIL_PUTS_ERROR("H5Dwrite() failed"); @@ -138,7 +138,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) if (H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1) < 0) FAIL_PUTS_ERROR("H5Dwrite() failed"); } /* end else */ - + /* flush into the file */ if (H5Fflush(file_id[i], H5F_SCOPE_LOCAL) < 0) FAIL_PUTS_ERROR("H5Fflush() failed"); @@ -146,7 +146,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* close dataset property list */ if (H5Pclose(plist) < 0) FAIL_PUTS_ERROR("H5Pclose() failed"); - + /* close dataspace */ if (H5Sclose(file_space) < 0) FAIL_PUTS_ERROR("H5Sclose() failed"); @@ -156,7 +156,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) FAIL_PUTS_ERROR("H5Dclose() failed"); /* get size of the file image i */ - if ((buf_size[i] = H5Fget_file_image(file_id[i], NULL, 0)) < 0) + if ((buf_size[i] = H5Fget_file_image(file_id[i], NULL, (size_t)0)) < 0) FAIL_PUTS_ERROR("H5Fget_file_image() failed"); /* allocate buffer for the file image i */ @@ -166,7 +166,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* buffer for file image 2 is filled with counter data (non-valid image) */ if (i == 2) { for (j = 0; j < (size_t)buf_size[i]; j++) - ((char*)(buf_ptr[i]))[j] = (char)j; + ((char*)(buf_ptr[i]))[j] = (char)j; } /* end if */ /* buffers for the rest of the file images are filled with data from the respective files */ else { @@ -181,14 +181,14 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) PASSED(); - TESTING("open file images and check image copies"); - - /* open the file images with the core driver for data access */ + HL_TESTING2("open file images and check image copies"); + + /* open the file images with the core driver for data access */ for (i = 0; i < open_images; i++) { /* open file image 2 filled with counter data (non-valid image) */ if (i == 2) { H5E_BEGIN_TRY { - /* attempt to set file image in the core driver */ + /* attempt to set file image in the core driver */ file_id[i] = H5LTopen_file_image(buf_ptr[i], (size_t)buf_size[i], input_flags[i]); } H5E_END_TRY @@ -196,7 +196,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) } /* end if */ /* open rest of valid file images */ else { - /* set file image in the core driver */ + /* set file image in the core driver */ if ((file_id[i] = H5LTopen_file_image(buf_ptr[i], (size_t)buf_size[i], input_flags[i])) < 0) FAIL_PUTS_ERROR("H5LTopen_file_image() failed"); @@ -221,7 +221,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) PASSED(); - TESTING("read file images"); + HL_TESTING2("read file images"); /* read open file images and verify data */ for (i = 0; i < open_images; i++) { @@ -231,7 +231,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) continue; } /* end if */ - /* open dataset in file image */ + /* open dataset in file image */ if ((dset_id[i] = H5Dopen2(file_id[i], DSET_NAME, H5P_DEFAULT)) < 0) FAIL_PUTS_ERROR("H5Dopen() failed"); @@ -246,8 +246,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* read dataset */ if (H5Dread(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data3) < 0) FAIL_PUTS_ERROR("H5Dread() failed"); - - /* compute number of elements in dataset */ + + /* compute number of elements in dataset */ n_values = (size_t)(dims3[0] * dims3[1]); /* determine the number of rows in dataset */ @@ -269,15 +269,15 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) if (data3[j * nrow + k ] != data1[j * nrow + k ]) FAIL_PUTS_ERROR("comparison of image values with original data failed"); } /* end else */ - - /* close dataspace */ + + /* close dataspace */ if (H5Sclose (file_space) < 0) FAIL_PUTS_ERROR("H5Sclose() failed"); } /* end for */ - PASSED(); + PASSED(); - TESTING("write and extend file images"); + HL_TESTING2("write and extend file images"); /* write open file images and verify data */ for (i = 0; i < open_images; i++) { @@ -337,7 +337,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) hid_t attr_space_id = -1; hid_t attr_id = -1; herr_t status2; - size_t l; + size_t l; if ((attr_space_id = H5Screate_simple(attr_rank, attr_dims, attr_dims)) < 0) FAIL_PUTS_ERROR("attr_space H5Screate_simple() failed"); @@ -392,7 +392,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) PASSED(); - TESTING("read extended file images"); + HL_TESTING2("read extended file images"); /* read open file images and verify data */ for (i = 0; i < open_images; i++) { @@ -400,7 +400,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) if ((file_id[i] < 0) || (!(input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW ))) continue; - /* open dataset in file image */ + /* open dataset in file image */ if ((dset_id[i] = H5Dopen2(file_id[i], DSET_NAME, H5P_DEFAULT)) < 0) FAIL_PUTS_ERROR("H5Dopen() failed"); @@ -415,8 +415,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* read dataset */ if (H5Dread(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data3) < 0) FAIL_PUTS_ERROR("H5Dread() failed"); - - /* compute number of elements in dataset */ + + /* compute number of elements in dataset */ n_values = (size_t)(dims3[0] * dims3[1]); /* determine the number of rows in dataset */ @@ -427,8 +427,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) for (k = 0; k < nrow; k++) if (data3[j * nrow + k ] != data4[j * nrow + k ]) FAIL_PUTS_ERROR("comparison of image values with original data failed"); - - /* close dataspace */ + + /* close dataspace */ if (H5Sclose (file_space) < 0) FAIL_PUTS_ERROR("H5Sclose() failed"); @@ -439,7 +439,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) PASSED() - TESTING("close file images"); + HL_TESTING2("close file images"); /* close file images and release buffer if appropriate */ for (i = 0; i < open_images; i++) { @@ -459,7 +459,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) VERIFY(buf_ptr[i] != NULL, "buffer pointer must be non NULL"); HDfree(buf_ptr[i]); } /* end if */ - + } /* end for */ /* release temporary working buffers */ @@ -491,8 +491,8 @@ int main( void ) size_t open_images = 10; /* number of open file images */ size_t nflags = 8; /* number of flag combinations */ unsigned flags[8]; /* array with flag combinations */ - - /* set flag combinations for testing */ + + /* set flag combinations for testing */ flags[0] = 0; flags[1] = H5LT_FILE_IMAGE_DONT_RELEASE; flags[2] = H5LT_FILE_IMAGE_DONT_COPY; diff --git a/hl/test/test_image.c b/hl/test/test_image.c index ac818d0..e350533 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -169,7 +169,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - TESTING("indexed image"); + HL_TESTING2("indexed image"); /* Write image */ if ( H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, buf1 ) < 0 ) @@ -205,7 +205,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - TESTING("true color image"); + HL_TESTING2("true color image"); /* Write image */ if ( H5IMmake_image_24bit( fid, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", buf2 ) ) @@ -232,7 +232,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - TESTING("pallete functions"); + HL_TESTING2("pallete functions"); if ( H5IMget_npalettes( fid, IMAGE1_NAME, &npals ) < 0 ) goto out; @@ -351,7 +351,7 @@ static int test_data(void) *------------------------------------------------------------------------- */ - TESTING2("make indexed image"); + HL_TESTING2("make indexed image"); /* read first data file */ if (read_data(DATA_FILE1,&width,&height)<0) @@ -364,7 +364,7 @@ static int test_data(void) PASSED(); - TESTING2("attaching palettes"); + HL_TESTING2("attaching palettes"); /*------------------------------------------------------------------------- * palette #1. rainbow palette. data is contained in "pal_rgb.h" @@ -464,7 +464,7 @@ static int test_data(void) *------------------------------------------------------------------------- */ - TESTING2("make true color image with pixel interlace"); + HL_TESTING2("make true color image with pixel interlace"); /* read second data file */ if ((read_data(DATA_FILE2,&width,&height))<0) @@ -481,7 +481,7 @@ static int test_data(void) *------------------------------------------------------------------------- */ - TESTING2("make true color image with plane interlace"); + HL_TESTING2("make true color image with plane interlace"); /* read third data file */ if ((read_data(DATA_FILE3,&width,&height))<0) @@ -538,13 +538,12 @@ static int test_generate(void) { hid_t fid; hsize_t pal_dims[2] = { 256, 3 }; - float *data; + float *data = NULL; int imax, jmax, kmax; int n_elements; float valex, xmin, xmax, value; FILE *f = NULL; - char *srcdir = getenv("srcdir"); /* the source directory */ - char data_file[512]=""; /* buffer to hold name of existing data file */ + const char *data_file = H5_get_srcdir_filename(DATA_FILE4); int i; int retval = FAIL; @@ -555,17 +554,6 @@ static int test_generate(void) printf("Testing read and process data and make indexed images\n"); /*------------------------------------------------------------------------- - * compose the name of the file to open, using the srcdir, if appropriate - *------------------------------------------------------------------------- - */ - if ( srcdir ) - { - HDstrcpy(data_file, srcdir); - HDstrcat(data_file, "/"); - } - HDstrcat(data_file,DATA_FILE4); - - /*------------------------------------------------------------------------- * read data; the file data format is described below *------------------------------------------------------------------------- */ @@ -613,8 +601,14 @@ static int test_generate(void) */ - fscanf( f, "%d %d %d", &imax, &jmax, &kmax ); - fscanf( f, "%f %f %f", &valex, &xmin, &xmax ); + if(fscanf( f, "%d %d %d", &imax, &jmax, &kmax ) < 0 && HDferror(f)) { + printf( "fscanf error in file %s.\n", data_file ); + goto out; + } /* end if */ + if(fscanf( f, "%f %f %f", &valex, &xmin, &xmax ) < 0 && HDferror(f)) { + printf( "fscanf error in file %s.\n", data_file ); + goto out; + } /* end if */ /* Sanity check on scanned-in values */ if(imax < 1 || jmax < 1 || kmax < 1) @@ -633,7 +627,7 @@ static int test_generate(void) goto out; if(n_elements > INT_MAX / (int)sizeof(float)) goto out; - + data = (float *)HDmalloc((size_t)n_elements * sizeof(float)); if(NULL == data) goto out; @@ -643,7 +637,10 @@ static int test_generate(void) for ( i = 0; i < n_elements; i++ ) { - fscanf( f, "%f ", &value ); + if(fscanf( f, "%f ", &value ) < 0 && HDferror(f)) { + printf( "fscanf error in file %s.\n", data_file ); + goto out; + } /* end if */ data[i] = value; } HDfclose(f); @@ -655,7 +652,7 @@ static int test_generate(void) *------------------------------------------------------------------------- */ - TESTING2("make indexed image from all the data"); + HL_TESTING2("make indexed image from all the data"); for ( i = 0; i < n_elements; i++ ) image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / (xmax - xmin )); @@ -672,7 +669,7 @@ static int test_generate(void) *------------------------------------------------------------------------- */ - TESTING2("make indexed image from land data"); + HL_TESTING2("make indexed image from land data"); for ( i = 0; i < n_elements; i++ ) { @@ -694,7 +691,7 @@ static int test_generate(void) *------------------------------------------------------------------------- */ - TESTING2("make indexed image from sea data"); + HL_TESTING2("make indexed image from sea data"); for ( i = 0; i < n_elements; i++ ) { @@ -715,7 +712,7 @@ static int test_generate(void) *------------------------------------------------------------------------- */ - TESTING2("attaching palettes"); + HL_TESTING2("attaching palettes"); /* make a palette */ if ((H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb))<0) @@ -804,12 +801,35 @@ static int read_data(const char* fname, /*IN*/ goto out; } - fscanf(f, "%s", str); - fscanf(f, "%d", &color_planes); - fscanf(f, "%s", str); - fscanf(f, "%d", &h); - fscanf(f, "%s", str); - fscanf(f, "%d", &w); + if(fscanf(f, "%s", str) < 0 && HDferror(f)) { + printf( "fscanf error in file %s.\n", data_file ); + goto out; + } /* end if */ + + if(fscanf(f, "%d", &color_planes) < 0 && HDferror(f)) { + printf( "fscanf error in file %s.\n", data_file ); + goto out; + } /* end if */ + + if(fscanf(f, "%s", str) < 0 && HDferror(f)) { + printf( "fscanf error in file %s.\n", data_file ); + goto out; + } /* end if */ + + if(fscanf(f, "%d", &h) < 0 && HDferror(f)) { + printf( "fscanf error in file %s.\n", data_file ); + goto out; + } /* end if */ + + if(fscanf(f, "%s", str) < 0 && HDferror(f)) { + printf( "fscanf error in file %s.\n", data_file ); + goto out; + } /* end if */ + + if(fscanf(f, "%d", &w) < 0 && HDferror(f)) { + printf( "fscanf error in file %s.\n", data_file ); + goto out; + } /* end if */ /* Check product for overflow */ if(w < 1 || h < 1 || color_planes < 1) @@ -840,14 +860,17 @@ static int read_data(const char* fname, /*IN*/ /* Read data elements */ for(i = 0; i < n_elements; i++) { - fscanf(f, "%d",&n); + if(fscanf(f, "%d", &n) < 0 && HDferror(f)) { + printf( "fscanf error in file %s.\n", data_file ); + goto out; + } /* end if */ image_data[i] = (unsigned char)n; } /* end for */ /* Indicate success */ ret_val = 1; -out: +out: if(f) HDfclose(f); @@ -885,20 +908,7 @@ static int read_palette(const char* fname, unsigned int green; unsigned int blue; unsigned nentries; - char *srcdir = getenv("srcdir"); /* the source directory */ - char data_file[512]; /* buffer to hold name of existing data file */ - - /*------------------------------------------------------------------------- - * compose the name of the file to open, using "srcdir", if appropriate - *------------------------------------------------------------------------- - */ - HDstrcpy(data_file, ""); - if (srcdir) - { - HDstrcpy(data_file, srcdir); - HDstrcat(data_file, "/"); - } - HDstrcat(data_file,fname); + const char *data_file = H5_get_srcdir_filename(fname); /* ensure the given palette is valid */ if (!palette) diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 8d3d0b9..e6b4668 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -87,7 +87,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset"); + HL_TESTING2("H5LTmake_dataset"); /* Make dataset */ if ( H5LTmake_dataset( file_id, DSET0_NAME, rank, dims, H5T_NATIVE_INT, data_int_in ) < 0 ) @@ -118,7 +118,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTread_dataset"); + HL_TESTING2("H5LTread_dataset"); if ( H5LTread_dataset( file_id, DSET0_NAME, H5T_NATIVE_INT, data_int_out ) < 0 ) goto out; @@ -143,7 +143,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_char"); + HL_TESTING2("H5LTmake_dataset_char"); /* Make dataset char */ if ( H5LTmake_dataset_char( file_id, DSET1_NAME, rank, dims, data_char_in ) < 0 ) @@ -179,7 +179,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_short"); + HL_TESTING2("H5LTmake_dataset_short"); /* Make dataset short */ if ( H5LTmake_dataset_short( file_id, DSET2_NAME, rank, dims, data_short_in ) < 0 ) @@ -214,7 +214,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_int"); + HL_TESTING2("H5LTmake_dataset_int"); /* Make dataset int */ if ( H5LTmake_dataset_int( file_id, DSET3_NAME, rank, dims, data_int_in ) < 0 ) @@ -250,7 +250,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_long"); + HL_TESTING2("H5LTmake_dataset_long"); /* Make dataset long */ if ( H5LTmake_dataset_long( file_id, DSET4_NAME, rank, dims, data_long_in ) < 0 ) @@ -286,7 +286,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_float"); + HL_TESTING2("H5LTmake_dataset_float"); /* Make dataset float */ if ( H5LTmake_dataset_float( file_id, DSET5_NAME, rank, dims, data_float_in ) < 0 ) @@ -298,7 +298,7 @@ static int test_dsets( void ) for (i = 0; i < DIM; i++) { - if(!FLT_ABS_EQUAL(data_float_in[i],data_float_out[i])) { + if(!H5_FLT_ABS_EQUAL(data_float_in[i],data_float_out[i])) { goto out; } } @@ -309,7 +309,7 @@ static int test_dsets( void ) for (i = 0; i < DIM; i++) { - if(!FLT_ABS_EQUAL(data_float_in[i],data_float_out[i])) { + if(!H5_FLT_ABS_EQUAL(data_float_in[i],data_float_out[i])) { goto out; } } @@ -322,7 +322,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_double"); + HL_TESTING2("H5LTmake_dataset_double"); /* Make dataset double */ if ( H5LTmake_dataset_double( file_id, DSET6_NAME, rank, dims, data_double_in ) < 0 ) @@ -334,7 +334,7 @@ static int test_dsets( void ) for (i = 0; i < DIM; i++) { - if(!DBL_ABS_EQUAL(data_double_in[i],data_double_out[i])) { + if(!H5_DBL_ABS_EQUAL(data_double_in[i],data_double_out[i])) { goto out; } } @@ -345,7 +345,7 @@ static int test_dsets( void ) for (i = 0; i < DIM; i++) { - if(!DBL_ABS_EQUAL(data_double_in[i],data_double_out[i])) { + if(!H5_DBL_ABS_EQUAL(data_double_in[i],data_double_out[i])) { goto out; } } @@ -358,7 +358,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_string"); + HL_TESTING2("H5LTmake_dataset_string"); /* Make dataset string */ if ( H5LTmake_dataset_string(file_id,DSET7_NAME,data_string_in) < 0 ) @@ -517,7 +517,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_string"); + HL_TESTING2("H5LTset_attribute_string"); /* Set the attribute */ if ( H5LTset_attribute_string( loc_id, obj_name, ATTR1_NAME, attr_str_in ) < 0 ) @@ -530,7 +530,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_string"); + HL_TESTING2("H5LTget_attribute_string"); /* Get the attribute */ @@ -550,7 +550,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_char"); + HL_TESTING2("H5LTset_attribute_char"); /* Set the attribute */ if ( H5LTset_attribute_char( loc_id, obj_name, ATTR2_NAME, attr_char_in, (size_t)5 ) < 0 ) @@ -563,7 +563,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_char"); + HL_TESTING2("H5LTget_attribute_char"); /* Get the attribute */ if ( H5LTget_attribute_char( loc_id, obj_name, ATTR2_NAME, attr_char_out ) < 0 ) @@ -594,7 +594,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_short"); + HL_TESTING2("H5LTset_attribute_short"); /* Set the attribute */ if ( H5LTset_attribute_short( loc_id, obj_name, ATTR3_NAME, attr_short_in, (size_t)5 ) < 0 ) @@ -608,7 +608,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_short"); + HL_TESTING2("H5LTget_attribute_short"); /* Get the attribute */ if ( H5LTget_attribute_short( loc_id, obj_name, ATTR3_NAME, attr_short_out ) < 0 ) @@ -640,7 +640,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_int"); + HL_TESTING2("H5LTset_attribute_int"); /* Set the attribute */ if ( H5LTset_attribute_int( loc_id, obj_name, ATTR4_NAME, attr_int_in, (size_t)5 ) < 0 ) @@ -661,7 +661,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_int"); + HL_TESTING2("H5LTget_attribute_int"); /* Get the attribute */ if ( H5LTget_attribute_int( loc_id, obj_name, ATTR4_NAME, attr_int_out ) < 0 ) @@ -712,7 +712,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_long"); + HL_TESTING2("H5LTset_attribute_long"); /* Set the attribute */ if ( H5LTset_attribute_long( loc_id, obj_name, ATTR5_NAME, attr_long_in, (size_t)5 ) < 0 ) @@ -725,7 +725,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_long"); + HL_TESTING2("H5LTget_attribute_long"); /* Get the attribute */ if ( H5LTget_attribute_long( loc_id, obj_name, ATTR5_NAME, attr_long_out ) < 0 ) @@ -756,7 +756,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_uchar"); + HL_TESTING2("H5LTset_attribute_uchar"); /* Set the attribute */ if ( H5LTset_attribute_uchar( loc_id, obj_name, ATTR6_NAME, attr_uchar_in, (size_t)5 ) < 0 ) @@ -769,7 +769,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_uchar"); + HL_TESTING2("H5LTget_attribute_uchar"); /* Get the attribute */ if ( H5LTget_attribute_uchar( loc_id, obj_name, ATTR6_NAME, attr_uchar_out ) < 0 ) @@ -800,7 +800,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_ushort"); + HL_TESTING2("H5LTset_attribute_ushort"); /* Set the attribute */ if ( H5LTset_attribute_ushort( loc_id, obj_name, ATTR7_NAME, attr_ushort_in, (size_t)5 ) < 0 ) @@ -814,7 +814,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_ushort"); + HL_TESTING2("H5LTget_attribute_ushort"); /* Get the attribute */ if ( H5LTget_attribute_ushort( loc_id, obj_name, ATTR7_NAME, attr_ushort_out ) < 0 ) @@ -846,7 +846,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_uint"); + HL_TESTING2("H5LTset_attribute_uint"); /* Set the attribute */ if ( H5LTset_attribute_uint( loc_id, obj_name, ATTR8_NAME, attr_uint_in, (size_t)5 ) < 0 ) @@ -859,7 +859,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_uint"); + HL_TESTING2("H5LTget_attribute_uint"); /* Get the attribute */ if ( H5LTget_attribute_uint( loc_id, obj_name, ATTR8_NAME, attr_uint_out ) < 0 ) @@ -890,7 +890,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_ulong"); + HL_TESTING2("H5LTset_attribute_ulong"); /* Set the attribute */ if ( H5LTset_attribute_ulong( loc_id, obj_name, ATTR9_NAME, attr_ulong_in, (size_t)5 ) < 0 ) @@ -903,7 +903,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_ulong"); + HL_TESTING2("H5LTget_attribute_ulong"); /* Get the attribute */ if ( H5LTget_attribute_ulong( loc_id, obj_name, ATTR9_NAME, attr_ulong_out ) < 0 ) @@ -935,7 +935,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_float"); + HL_TESTING2("H5LTset_attribute_float"); /* Set the attribute */ if ( H5LTset_attribute_float( loc_id, obj_name, ATTR10_NAME, attr_float_in, (size_t)5 ) < 0 ) @@ -948,7 +948,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_float"); + HL_TESTING2("H5LTget_attribute_float"); /* Get the attribute */ @@ -957,7 +957,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) for (i = 0; i < 5; i++) { - if(!FLT_ABS_EQUAL(attr_float_in[i],attr_float_out[i])) { + if(!H5_FLT_ABS_EQUAL(attr_float_in[i],attr_float_out[i])) { return -1; } } @@ -968,7 +968,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) for (i = 0; i < 5; i++) { - if(!FLT_ABS_EQUAL(attr_float_in[i],attr_float_out[i])) { + if(!H5_FLT_ABS_EQUAL(attr_float_in[i],attr_float_out[i])) { return -1; } } @@ -980,7 +980,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_double"); + HL_TESTING2("H5LTset_attribute_double"); /* Set the attribute */ if ( H5LTset_attribute_double( loc_id, obj_name, ATTR11_NAME, attr_double_in, (size_t)5 ) < 0 ) @@ -993,7 +993,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_double"); + HL_TESTING2("H5LTget_attribute_double"); /* Get the attribute */ if ( H5LTget_attribute_double( loc_id, obj_name, ATTR11_NAME, attr_double_out ) < 0 ) @@ -1001,7 +1001,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) for (i = 0; i < 5; i++) { - if(!DBL_ABS_EQUAL(attr_double_in[i],attr_double_out[i])) { + if(!H5_DBL_ABS_EQUAL(attr_double_in[i],attr_double_out[i])) { return -1; } } @@ -1012,7 +1012,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) for (i = 0; i < 5; i++) { - if(!DBL_ABS_EQUAL(attr_double_in[i],attr_double_out[i])) { + if(!H5_DBL_ABS_EQUAL(attr_double_in[i],attr_double_out[i])) { return -1; } } @@ -1026,7 +1026,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) */ - TESTING("H5LTget_attribute_ndims"); + HL_TESTING2("H5LTget_attribute_ndims"); if ( H5LTget_attribute_ndims( loc_id, obj_name, ATTR2_NAME, &rank_out ) < 0 ) return -1; @@ -1042,7 +1042,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_info"); + HL_TESTING2("H5LTget_attribute_info"); if(NULL==(dims_out = (hsize_t*) HDmalloc( sizeof(hsize_t) * (size_t)rank_out ))) return -1; @@ -1050,7 +1050,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) HDfree( dims_out ); return -1; } - + for (i = 0; i < rank_out; i++) { if ( dims_out[i] != 5 ) { HDfree( dims_out ); @@ -1079,7 +1079,7 @@ static int test_integers(void) char* dt_str; size_t str_len; - TESTING3("\n text for integer types"); + HL_TESTING3("\n text for integer types"); if((dtype = H5LTtext_to_dtype("H5T_NATIVE_INT\n", H5LT_DDL))<0) goto out; @@ -1136,7 +1136,7 @@ static int test_fps(void) char* dt_str; size_t str_len; - TESTING3(" text for floating-point types"); + HL_TESTING3(" text for floating-point types"); if((dtype = H5LTtext_to_dtype("H5T_NATIVE_LDOUBLE\n", H5LT_DDL))<0) goto out; @@ -1152,7 +1152,7 @@ static int test_fps(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { @@ -1194,10 +1194,10 @@ static int test_strings(void) H5T_str_t str_pad; H5T_cset_t str_cset; H5T_class_t type_class; - char* dt_str; + char* dt_str = NULL; size_t str_len; - TESTING3(" text for string types"); + HL_TESTING3(" text for string types"); if((dtype = H5LTtext_to_dtype("H5T_STRING { STRSIZE 13; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; }", H5LT_DDL))<0) goto out; @@ -1228,7 +1228,7 @@ static int test_strings(void) goto out; } if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1260,7 +1260,7 @@ static int test_strings(void) goto out; } if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1270,16 +1270,17 @@ static int test_strings(void) str_len = str_len + 10; if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { HDfree(dt_str); goto out; } if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len-1)) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } + HDfree(dt_str); /* Length of the character buffer is smaller then needed */ str_len = 21; @@ -1291,10 +1292,10 @@ static int test_strings(void) goto out; } /* check the truncated string */ - if(strlen(dt_str) != str_len-1) goto out; - str_len = strlen(dt_str); + if(HDstrlen(dt_str) != str_len-1) goto out; + str_len = HDstrlen(dt_str); if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len)) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1327,7 +1328,7 @@ static int test_opaques(void) char* dt_str; size_t str_len; - TESTING3(" text for opaque types"); + HL_TESTING3(" text for opaque types"); if((dtype = H5LTtext_to_dtype("H5T_OPAQUE { OPQ_SIZE 19; OPQ_TAG \"This is a tag for opaque type\"; }", H5LT_DDL))<0) goto out; @@ -1351,7 +1352,7 @@ static int test_opaques(void) goto out; } if(HDstrcmp(dt_str, "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1384,7 +1385,7 @@ static int test_enums(void) char* dt_str; size_t str_len; - TESTING3(" text for enum types"); + HL_TESTING3(" text for enum types"); if((dtype = H5LTtext_to_dtype("H5T_ENUM { H5T_STD_I32LE; \"RED\" 5; \"GREEN\" 6; \"BLUE\" 7; \"WHITE\" 8; }", H5LT_DDL))<0) goto out; @@ -1427,7 +1428,7 @@ static int test_enums(void) } if(HDstrcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1456,7 +1457,7 @@ static int test_variables(void) char* dt_str; size_t str_len; - TESTING3(" text for variable types"); + HL_TESTING3(" text for variable types"); if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_NATIVE_CHAR }\n", H5LT_DDL))<0) goto out; @@ -1468,16 +1469,16 @@ static int test_variables(void) if(H5Tis_variable_str(dtype)) goto out; - + if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_VLEN { H5T_STD_I32BE } }", H5LT_DDL))<0) goto out; - + if(H5Tis_variable_str(dtype)) goto out; - + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) @@ -1487,15 +1488,15 @@ static int test_variables(void) goto out; } if(HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } HDfree(dt_str); - + if(H5Tclose(dtype)<0) goto out; - + PASSED(); return 0; @@ -1517,7 +1518,7 @@ static int test_arrays(void) char* dt_str; size_t str_len; - TESTING3(" text for array types"); + HL_TESTING3(" text for array types"); if((dtype = H5LTtext_to_dtype("H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE \"arr_compound_1\"; H5T_STD_I32BE \"arr_compound_2\"; } } }", H5LT_DDL))<0) goto out; @@ -1546,7 +1547,7 @@ static int test_arrays(void) goto out; } if(HDstrcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE \"arr_compound_2\" : 1;\n }\n }\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1578,7 +1579,7 @@ static int test_compounds(void) char* dt_str; size_t str_len; - TESTING3(" text for compound types"); + HL_TESTING3(" text for compound types"); if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I16BE \"one_field\" : 2; H5T_STD_U8LE \"two_field\" : 6; }", H5LT_DDL))<0) goto out; @@ -1602,7 +1603,7 @@ static int test_compounds(void) goto out; } if(HDstrcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE \"two_field\" : 6;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1636,7 +1637,7 @@ out: } /*------------------------------------------------------------------------- -* subroutine for test_text_dtype(): test_compound_bug(). Test case for +* subroutine for test_text_dtype(): test_compound_bug(). Test case for * issue 7701. *------------------------------------------------------------------------- */ @@ -1672,7 +1673,7 @@ static int test_compound_bug(void) " } } \"sub\" : 8;\n" "}\n"; - TESTING3(" text for compound type of bug fix"); + HL_TESTING3(" text for compound type of bug fix"); if((dtype = H5LTtext_to_dtype(text, H5LT_DDL))<0) goto out; @@ -1762,22 +1763,14 @@ static int test_complicated_compound(void) char *line = NULL; FILE *fp = NULL; size_t size = 1024; - char *srcdir = getenv("srcdir"); /* the source directory */ - char filename[1024]=""; - - TESTING3(" text for complicated compound types"); + const char *filename = H5_get_srcdir_filename(INPUT_FILE); - /* compose the name of the file to open, using the srcdir, if appropriate */ - if(srcdir) { - HDstrcpy(filename, srcdir); - HDstrcat(filename, "/"); - } - HDstrcat(filename, INPUT_FILE); + HL_TESTING3(" text for complicated compound types"); /* Open input file */ fp = HDfopen(filename, "r"); if(fp == NULL) { - printf( "Could not find file %s. Try set $srcdir \n", filename); + HDprintf( "Could not find file %s. Try set $srcdir \n", filename); goto out; } @@ -1841,7 +1834,7 @@ out: */ static int test_text_dtype(void) { - TESTING("H5LTtext_to_dtype"); + HL_TESTING2("H5LTtext_to_dtype"); if(test_integers()<0) goto out; @@ -1888,9 +1881,9 @@ static int test_valid_path(void) hid_t file_id, group; htri_t path_valid; const char *data_string_in = "test"; - - TESTING("H5LTpath_valid"); - + + HL_TESTING2("H5LTpath_valid"); + /* Create a new file using default properties. */ /************************************************************** @@ -1915,11 +1908,11 @@ static int test_valid_path(void) * | * | * | --- Gcyc (soft link to /G1) - * / \ - * / \ - * G5 \ + * / \ + * / \ + * G5 \ * (soft link G6 (external link /G1 in FILENAME4) - * to /G2) + * to /G2) * ****************************************************************/ @@ -1948,7 +1941,7 @@ static int test_valid_path(void) */ if(H5LTmake_dataset_string(group, "/G2/DS4", data_string_in)<0) goto out; - + /* * Create a soft link */ @@ -2030,9 +2023,9 @@ static int test_valid_path(void) * | * | * | - * G1 + * G1 * / \ - * / \ + * / \ * DS1 G2 * (dangled soft link to /G1/G20) * @@ -2063,27 +2056,27 @@ static int test_valid_path(void) goto out; H5Fclose(file_id); - + /* Open input file */ if((file_id = H5Fopen(FILE_NAME3,H5F_ACC_RDONLY, H5P_DEFAULT))<0) goto out; /************************************** - * CHECK ABSOLUTE PATHS + * CHECK ABSOLUTE PATHS **************************************/ - if( (path_valid = H5LTpath_valid(file_id, "/", TRUE)) != FALSE) { + if( (path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) { goto out; } - if( (path_valid = H5LTpath_valid(file_id, "/", FALSE)) != FALSE) { + if( (path_valid = H5LTpath_valid(file_id, "/", FALSE)) != TRUE) { goto out; } if( (path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) { goto out; } - + if((path_valid = H5LTpath_valid(file_id, "/G1/DS1", TRUE)) != TRUE) goto out; @@ -2101,7 +2094,7 @@ static int test_valid_path(void) if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", TRUE)) != TRUE) goto out; - + if( (path_valid = H5LTpath_valid(file_id, "/G2", TRUE)) != TRUE) goto out; @@ -2121,19 +2114,19 @@ static int test_valid_path(void) /* check soft links */ if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", TRUE)) != TRUE) goto out; - + /************************************** - * CHECK RELATIVE PATHS + * CHECK RELATIVE PATHS ***************************************/ if( (group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0) goto out; - - if( (path_valid = H5LTpath_valid(group, "/", TRUE)) != FALSE) { + + if( (path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) { goto out; } - if( (path_valid = H5LTpath_valid(group, "/", FALSE)) != FALSE) { + if( (path_valid = H5LTpath_valid(group, "/", FALSE)) != TRUE) { goto out; } @@ -2163,22 +2156,22 @@ static int test_valid_path(void) goto out; if( (path_valid = H5LTpath_valid(group, "G2/G5", TRUE)) != TRUE) - goto out; + goto out; /* Check the "./" case */ if( (path_valid = H5LTpath_valid(group, "./DS3", TRUE)) != TRUE) goto out; if( (path_valid = H5LTpath_valid(group, "./G2/G5", TRUE)) != TRUE) - goto out; + goto out; /* Should fail, does not exist */ if( (path_valid = H5LTpath_valid(group, "./G2/G20", FALSE)) == TRUE) - goto out; + goto out; /* Should fail, does not exist */ if( (path_valid = H5LTpath_valid(group, "./G2/G20", TRUE)) == TRUE) - goto out; + goto out; if(H5Gclose(group)<0) goto out; @@ -2227,7 +2220,7 @@ static int test_valid_path(void) PASSED(); return 0; - out: + out: H5_FAILED(); return -1; } diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index 7003b26..61aebc7 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -178,7 +178,7 @@ static int test_create_close(hid_t fid) hid_t table; hid_t part_t; - TESTING("H5PTcreate_fl and H5PTclose"); + HL_TESTING2("H5PTcreate_fl and H5PTclose"); /* Create a datatype for the particle struct */ part_t = make_particle_type(); @@ -188,11 +188,11 @@ static int test_create_close(hid_t fid) /* Create the table */ table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1); if (H5Tclose(part_t) < 0) - goto error; + goto error; if( H5PTis_valid(table) < 0) - goto error; + goto error; if( H5PTis_varlen(table) != 0) - goto error; + goto error; /* Close the table */ err = H5PTclose(table); @@ -219,7 +219,7 @@ static int test_open(hid_t fid) herr_t err; hid_t table; - TESTING("H5PTopen"); + HL_TESTING2("H5PTopen"); /* Open the table */ table = H5PTopen(fid, PT_NAME); @@ -255,7 +255,7 @@ static int test_append(hid_t fid) hid_t table; hsize_t count = 0; - TESTING("H5PTappend"); + HL_TESTING2("H5PTappend"); /* Open the table */ table = H5PTopen(fid, PT_NAME); @@ -322,7 +322,7 @@ static int test_read(hid_t fid) particle_t readBuf[NRECORDS]; size_t c; - TESTING("H5PTread_packets"); + HL_TESTING2("H5PTread_packets"); /* Open the table */ table = H5PTopen(fid, PT_NAME); @@ -383,7 +383,7 @@ static int test_get_next(hid_t fid) particle_t readBuf2[NRECORDS]; size_t c; - TESTING("H5PTget_next"); + HL_TESTING2("H5PTget_next"); /* Open the table */ table = H5PTopen(fid, PT_NAME); @@ -454,7 +454,7 @@ static int test_big_table(hid_t fid) particle_t readPart; hsize_t count; - TESTING("large packet table"); + HL_TESTING2("large packet table"); /* Create a datatype for the particle struct */ part_t = make_particle_type(); @@ -528,7 +528,7 @@ static int test_opaque(hid_t fid) size_t c; particle_t readBuf[NRECORDS]; - TESTING("opaque data"); + HL_TESTING2("opaque data"); /* Create an opaque datatype for the particle struct */ if ((part_t = H5Tcreate (H5T_OPAQUE, sizeof(particle_t) )) < 0 ) @@ -602,7 +602,7 @@ test_compress(void) particle_t readPart[1]; hsize_t count; - TESTING("packet table compression"); + HL_TESTING2("packet table compression"); /* Create a file. */ if((fid1 = H5Fcreate(TEST_COMPRESS_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -739,7 +739,7 @@ static int test_rw_nonnative_dt(hid_t fid) int writeBuffer[5]; int readBuffer[5]; - TESTING("reading/writing non-native packet table"); + HL_TESTING2("reading/writing non-native packet table"); /* Initialize buffers */ for(x=0; x<5; x++) { @@ -794,7 +794,7 @@ static int test_rw_nonnative_dt(hid_t fid) /* Close the packet table */ if( (err = H5PTclose(ptable)) < 0) goto error; - + PASSED(); return SUCCEED; @@ -819,7 +819,7 @@ static int test_error(hid_t fid) int id_open=0; particle_t readBuf[1]; - TESTING("error conditions"); + HL_TESTING2("error conditions"); /* Create a HL table */ if(create_hl_table(fid) < 0) @@ -981,7 +981,7 @@ int main(void) /* Close the file */ if (H5Fclose(fid) < 0) - status = 1; + status = 1; return status; } diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c index 35bd43a..4d83ae6 100644 --- a/hl/test/test_packet_vlen.c +++ b/hl/test/test_packet_vlen.c @@ -46,24 +46,24 @@ static int verify_attribute(hid_t fid, const char *table_name, const char *attr_ /*------------------------------------------------------------------------- * test_VLof_atomic(): Test that a packet table with VL datatypes of atomic - * datatypes can be created and written correctly. (HDFFV-442) + * datatypes can be created and written correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int test_VLof_atomic(void) { - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ - hsize_t count; /* Number of records in the table */ - unsigned uu, vv; /* Loop variables */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ - - TESTING3(" with vlen of atomic"); + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hsize_t count; /* Number of records in the table */ + unsigned uu, vv; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + HL_TESTING3(" with vlen of atomic"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -71,42 +71,42 @@ static int test_VLof_atomic(void) if (writeBuf[uu].p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].len = uu + 1; for (vv = 0; vv < (uu + 1); vv++) - ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv; + ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv; } /* end for */ /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a vlen type that uses an atomic datatype as its base type */ vltype = H5Tvlen_create (H5T_NATIVE_UINT); if (vltype < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of an atomic type */ ptable = H5PTcreate(fid, PT_VLEN_ATOMIC, vltype, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Close the vlen datatype */ if (H5Tclose(vltype) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -114,33 +114,33 @@ static int test_VLof_atomic(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf ); if (ret < 0) - goto error; + goto error; for (uu = 0; uu < NRECORDS; uu++) for (vv = 0; vv < (uu + 1); vv++) { - if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { - printf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); - printf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); - } + if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { + printf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); + printf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); + } } /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf ); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -157,7 +157,7 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * test_VLof_comptype(): Test that a packet table with VL datatypes of - * compound datatypes can be created and written correctly. (HDFFV-442) + * compound datatypes can be created and written correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -169,18 +169,18 @@ static int test_VLof_comptype(void) unsigned u; float f; } VLcomp_t; - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ - hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - hsize_t count; /* Number of records in the table */ - unsigned uu, vv; /* Loop variables */ - char msg[80]; /* For error message */ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + hsize_t count; /* Number of records in the table */ + unsigned uu, vv; /* Loop variables */ + char msg[80]; /* For error message */ herr_t ret; - TESTING3(" with vlen of compound datatypes"); + HL_TESTING3(" with vlen of compound datatypes"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -188,7 +188,7 @@ static int test_VLof_comptype(void) if(writeBuf[uu].p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].len = uu + 1; for (vv = 0; vv < (uu + 1); vv++) { ((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv; @@ -199,48 +199,48 @@ static int test_VLof_comptype(void) /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create the base compound type */ cmptype = H5Tcreate(H5T_COMPOUND, sizeof(VLcomp_t)); if (cmptype < 0) - goto error; + goto error; /* Insert fields */ ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT); if (ret < 0) - goto error; + goto error; /* Create a variable length type that uses the VLcomp_t as its base type */ vltype = H5Tvlen_create(cmptype); if (vltype < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of compound datatype */ ptable = H5PTcreate(fid, PT_VLEN_COMP, vltype, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release the datatypes */ if (H5Tclose(cmptype) < 0) - goto error; + goto error; if (H5Tclose(vltype) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)5, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -248,39 +248,39 @@ static int test_VLof_comptype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].len != readBuf[uu].len) { fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len); - continue; - } /* write len != read len */ + continue; + } /* write len != read len */ for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) { fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv, (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]); continue; - } /* write value != read value */ - } + } /* write value != read value */ + } } /* end for */ /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -298,8 +298,8 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * test_compound_VL_VL(): Test that a packet table of compound datatypes - * containing VL datatypes can be created and written - * correctly. (HDFFV-442) + * containing VL datatypes can be created and written + * correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -310,23 +310,23 @@ static int test_compound_VL_VLtype(void) typedef struct { unsigned u; float f; - hvl_t v; + hvl_t v; } compVLVL_t; - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ - hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */ - hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing - a VL of VL of atomic datatype */ - hsize_t count; /* Number of records in the table */ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */ + hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing + a VL of VL of atomic datatype */ + hsize_t count; /* Number of records in the table */ compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */ compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */ hvl_t *t1, *t2; - unsigned uu, vv, ww; /* Loop variables */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ + unsigned uu, vv, ww; /* Loop variables */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ - TESTING3(" with compound datatype containing vlen datatype"); + HL_TESTING3(" with compound datatype containing vlen datatype"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -336,15 +336,15 @@ static int test_compound_VL_VLtype(void) if (writeBuf[uu].v.p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].v.len = uu + L1_INCM; for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++) - { + { t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int)); - if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); - goto error; - } + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + goto error; + } t1->len = vv + L2_INCM; for (ww = 0; ww < vv + L2_INCM; ww++) ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww; @@ -354,58 +354,58 @@ static int test_compound_VL_VLtype(void) /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a VL datatype of an atomic type */ vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); if (vlatomic < 0) - goto error; + goto error; /* Create a VL datatype of the VL of atomic datatype */ vlofvl = H5Tvlen_create (vlatomic); if (vlofvl < 0) - goto error; + goto error; /* Create the base compound type */ comp_vlvl = H5Tcreate(H5T_COMPOUND, sizeof(compVLVL_t)); if (comp_vlvl < 0) - goto error; + goto error; /* Insert fields: atomic, atomic, vlen */ ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(comp_vlvl, "v", HOFFSET(compVLVL_t, v), vlofvl); if (ret < 0) - goto error; + goto error; /* Create a packet table that uses a compound datatype of vlen datatype */ ptable = H5PTcreate(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release datatypes */ if (H5Tclose(vlatomic) < 0) - goto error; + goto error; if (H5Tclose(vlofvl) < 0) - goto error; + goto error; if (H5Tclose(comp_vlvl) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -413,7 +413,7 @@ static int test_compound_VL_VLtype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { @@ -448,19 +448,19 @@ static int test_compound_VL_VLtype(void) /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -479,27 +479,27 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * test_VLof_VLtype(): Test that a packet table of VL datatype with VL - * datatypes of atomic datatypes can be created and written - * correctly. (HDFFV-442) + * datatypes of atomic datatypes can be created and written + * correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int test_VLof_VLtype(void) { - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ - hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */ - hsize_t count; /* Number of records in the table */ - hvl_t *t1; /* pointer to advance */ - unsigned uu, vv, ww; /* Loop variables */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ - - TESTING3(" with vlen datatype of vlen datatype"); + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */ + hsize_t count; /* Number of records in the table */ + hvl_t *t1; /* pointer to advance */ + unsigned uu, vv, ww; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + HL_TESTING3(" with vlen datatype of vlen datatype"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -510,12 +510,12 @@ static int test_VLof_VLtype(void) } /* end if */ writeBuf[uu].len = uu + 1; for (t1=(hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++) - { + { t1->p = HDmalloc((vv + 1) * sizeof(unsigned int)); - if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); - goto error; - } + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + goto error; + } t1->len = vv * 1; for (ww = 0; ww < (vv * 1); ww++) ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww; @@ -525,39 +525,39 @@ static int test_VLof_VLtype(void) /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a VL datatype of an atomic type */ vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); if (vlatomic < 0) - goto error; + goto error; vlofvl = H5Tvlen_create (vlatomic); if (vlofvl < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of vlen datatype */ ptable = H5PTcreate(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release datatypes */ if (H5Tclose(vlatomic) < 0) - goto error; + goto error; if (H5Tclose(vlofvl) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)5, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -565,24 +565,24 @@ static int test_VLof_VLtype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -600,41 +600,41 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * verify_ptlengthtype() - helper function, verifies that the named packet - * table is a fixed-length or variable-length as indicated by the last - * argument. + * table is a fixed-length or variable-length as indicated by the last + * argument. * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int verify_ptlengthtype(hid_t fid, const char *table_name, herr_t expected_value) { - hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ + hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ herr_t is_varlen = 0; herr_t ret = FAIL; /* Open the named packet table */ if( (ptable = H5PTopen(fid, table_name)) < 0) - goto error; + goto error; /* Verify the value returned from H5PTis_varlen is as expected */ is_varlen = H5PTis_varlen(ptable); if (is_varlen == FAIL) - goto error; + goto error; else if (is_varlen == expected_value) - ret = SUCCEED; + ret = SUCCEED; else { - char lenthtype[20]; - HDstrcpy(lenthtype, "fixed-length"); - if (expected_value == 1) - HDstrcpy(lenthtype, "variable-length"); - fprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype); - ret = FAIL; + char lenthtype[20]; + HDstrcpy(lenthtype, "fixed-length"); + if (expected_value == 1) + HDstrcpy(lenthtype, "variable-length"); + fprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype); + ret = FAIL; } /* Close the packet table */ if (H5PTclose(ptable) < 0) - goto error; + goto error; return ret; @@ -645,71 +645,71 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * test_H5PTis_varlen(): Test that H5PTis_varlen works correctly on both - * fixed- and variable-length packet tables. + * fixed- and variable-length packet tables. * * Description: - * - Added a fixed-length packet table to the file for variety - * - Use the helper funtion verify_ptlengthtype to test H5PTis_varlen - * on each packet table. + * - Added a fixed-length packet table to the file for variety + * - Use the helper funtion verify_ptlengthtype to test H5PTis_varlen + * on each packet table. * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int test_H5PTis_varlen(void) { - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - herr_t ret; /* Returned status from a callee */ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + herr_t ret; /* Returned status from a callee */ - TESTING("H5PTis_varlen"); + HL_TESTING2("H5PTis_varlen"); /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a new table */ ptable = H5PTcreate(fid, PT_FIXED_LEN, H5T_STD_I32BE, (hsize_t)100, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Open each packet table, and verify that H5PTis_varlen returns correct type for each table */ ret = verify_ptlengthtype(fid, PT_VLEN_ATOMIC, 1); /* vlen of atomic */ if (ret < 0) - goto error; + goto error; ret = verify_ptlengthtype(fid, PT_VLEN_COMP, 1); /* vlen of compound */ if (ret < 0) - goto error; + goto error; ret = verify_ptlengthtype(fid, PT_COMP_VLEN, 0); /* compound of vlen, no vlen */ if (ret < 0) - goto error; + goto error; ret = verify_ptlengthtype(fid, PT_VLEN_VLEN, 1); /* vlen of vlen */ if (ret < 0) - goto error; + goto error; ret = verify_ptlengthtype(fid, PT_FIXED_LEN, 0); /* no vlen */ if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -722,11 +722,11 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * adding_attribute() - helper function, adds an attribute to the named - * packet table. + * packet table. * Note: - * For simplicity, the attributes that are added to the packet tables - * have the same characteristics except their names. They have the - * same type, space, and values. + * For simplicity, the attributes that are added to the packet tables + * have the same characteristics except their names. They have the + * same type, space, and values. * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -737,47 +737,47 @@ int attr_data[ATTR_DIM]={256,11945,-22107}; /* values to be written to attr */ static int adding_attribute(hid_t fid, const char *table_name, const char *attr_name) { - hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ - hid_t space_id = H5I_INVALID_HID; /* Dataspace for the attribute */ - hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */ - hid_t dset_id = H5I_INVALID_HID; /* Dataset identifier */ - hsize_t dims[] = {ATTR_DIM}; /* Dimension for dataspace */ - int ret = FAIL; /* Returned status from a callee */ + hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ + hid_t space_id = H5I_INVALID_HID; /* Dataspace for the attribute */ + hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */ + hid_t dset_id = H5I_INVALID_HID; /* Dataset identifier */ + hsize_t dims[] = {ATTR_DIM}; /* Dimension for dataspace */ + int ret = FAIL; /* Returned status from a callee */ /* Create dataspace for attribute */ space_id = H5Screate_simple(ATTR_RANK, dims, NULL); if (space_id < 0) - goto error; + goto error; /* Open the named packet table */ if( (ptable = H5PTopen(fid, table_name)) < 0) - goto error; + goto error; dset_id = H5PTget_dataset(ptable); if (dset_id < 0) - goto error; + goto error; /* Add the specified attribute to it */ attr_id = H5Acreate2(dset_id, attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT); if (attr_id < 0) - goto error; + goto error; /* Write attribute values */ ret = H5Awrite(attr_id, H5T_NATIVE_INT, attr_data); if (ret < 0) - goto error; + goto error; /* Close the attribute */ if (H5Aclose(attr_id) < 0) - goto error; + goto error; /* Close the dataspace */ if (H5Sclose(space_id) < 0) - goto error; + goto error; /* Close the packet table */ if (H5PTclose(ptable) < 0) - goto error; + goto error; return SUCCEED; @@ -790,39 +790,39 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * verify_attribute() - helper function, verifies the named attribute can - * be read correctly. + * be read correctly. * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static herr_t verify_attribute(hid_t fid, const char *table_name, const char *attr_name) { - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */ - hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */ - int read_data[ATTR_DIM]; /* Output buffer */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */ + hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */ + int read_data[ATTR_DIM]; /* Output buffer */ int ii; - herr_t ret = FAIL; /* Returned status from a callee */ + herr_t ret = FAIL; /* Returned status from a callee */ /* Open the named packet table */ ptable = H5PTopen(fid, table_name); if (ptable < 0) - goto error; + goto error; /* Get the dataset id of this packet table */ dset_id = H5PTget_dataset(ptable); if (dset_id < 0) - goto error; + goto error; /* Open first attribute for the dataset */ attr_id = H5Aopen(dset_id, attr_name, H5P_DEFAULT); if (attr_id < 0) - goto error; + goto error; /* Read attribute values */ ret = H5Aread(attr_id, H5T_NATIVE_INT, read_data); if (ret < 0) - goto error; + goto error; /* Verify values read in */ for (ii = 0; ii < ATTR_DIM; ii++) @@ -831,11 +831,11 @@ static herr_t verify_attribute(hid_t fid, const char *table_name, const char *at /* Close the attribute */ if (H5Aclose(attr_id) < 0) - goto error; + goto error; /* Close the packet table */ if (H5PTclose(ptable) < 0) - goto error; + goto error; return SUCCEED; @@ -849,58 +849,58 @@ error: /* An error has occurred. Clean up and exit. */ * test_attributes(): Test adding attributes to packet tables * * Description: - * Added attributes to some random packet tables in the file. + * Added attributes to some random packet tables in the file. * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int test_attributes(void) { - hid_t fid=H5I_INVALID_HID; /* File identifier */ - hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */ - herr_t ret = FAIL; /* Returned status from a callee */ + hid_t fid=H5I_INVALID_HID; /* File identifier */ + hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */ + herr_t ret = FAIL; /* Returned status from a callee */ - TESTING("adding attributes to packet tables"); + HL_TESTING2("adding attributes to packet tables"); /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Add an arbitrary attribute to a few packet tables, using helper func */ attr_id = adding_attribute(fid, PT_VLEN_ATOMIC, "Attribute 1"); if (attr_id < 0) - goto error; + goto error; attr_id = adding_attribute(fid, PT_VLEN_COMP, "Attribute 2"); if (attr_id < 0) - goto error; + goto error; attr_id = adding_attribute(fid, PT_COMP_VLEN, "Attribute 3"); if (attr_id < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; /* Open the file again */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Read each attribute and verify the values, using helper function */ ret = verify_attribute(fid, PT_VLEN_ATOMIC, "Attribute 1"); if (ret < 0) - goto error; + goto error; ret = verify_attribute(fid, PT_VLEN_COMP, "Attribute 2"); if (ret < 0) - goto error; + goto error; ret = verify_attribute(fid, PT_COMP_VLEN, "Attribute 3"); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return(ret); @@ -913,79 +913,75 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * verify_accessors() - helper function, verifies that various info can be - * retrieved correctly using the info returned by the accessor functions. + * retrieved correctly using the info returned by the accessor functions. * * Description: - * Testing functions H5PTget_dataset and H5PTget_type + * Testing functions H5PTget_dataset and H5PTget_type * - * - Opens the named packet table - * - Gets its associated dataset ID then calls a C function on that ID - * to verify the dataset name - * - Gets its associated datatype ID then calls a C function on that ID - * to verify that the packet table is variable- or fixed-length as - * indicated by the expected_value argument + * - Opens the named packet table + * - Gets its associated dataset ID then calls a C function on that ID + * to verify the dataset name + * - Gets its associated datatype ID then calls a C function on that ID + * to verify that the packet table is variable- or fixed-length as + * indicated by the expected_value argument * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ -static herr_t verify_accessors(hid_t fid, const char *table_name, herr_t expected_value) +static herr_t verify_accessors(hid_t fid, const char *table_name, hbool_t uses_vlen_type) { - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */ - hid_t dtype_id=H5I_INVALID_HID; /* Dataset identifier */ + hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ + hid_t dset_id = H5I_INVALID_HID; /* Dataset associated with the pt */ + hid_t dtype_id = H5I_INVALID_HID; /* Dataset identifier */ char buf[NAME_BUF_SIZE]; ssize_t name_size; - herr_t is_varlen = 0; - herr_t ret = FAIL; /* Returned status from a callee */ + htri_t vlen_check_result = -1; /* Open the named packet table. */ - ptable = H5PTopen(fid, table_name); - if (ptable < 0) - goto error; + if((ptable = H5PTopen(fid, table_name)) < 0) + goto error; /* Get the associated dataset ID. */ - dset_id = H5PTget_dataset(ptable); - if (dset_id < 0) - goto error; + if((dset_id = H5PTget_dataset(ptable)) < 0) + goto error; /* Check if the packet table's name matches its associated dataset's. */ *buf = '\0'; - name_size = H5Iget_name(dset_id, (char*)buf, NAME_BUF_SIZE); - if (name_size < 0) - goto error; + if((name_size = H5Iget_name(dset_id, (char*)buf, NAME_BUF_SIZE)) < 0) + goto error; VERIFY(HDstrcmp(buf, table_name), "Names of dataset and packet table don't match"); /* Get the packet table's datatype ID */ - dtype_id = H5PTget_type(ptable); - if (dtype_id < 0) - goto error; + if((dtype_id = H5PTget_type(ptable)) < 0) + goto error; /* Check if the type class matches that of the packet table. */ - is_varlen = H5Tdetect_class(dtype_id, H5T_VLEN); - if (is_varlen == FAIL) /* failure occurred */ - goto error; - else if (is_varlen == expected_value) /* length types match */ - ret = SUCCEED; - else /* length types don't match */ - { - /* Give lengthtype "fixed-length" or "variable-length" depending on the - expected_value passed in, then print the error message. */ - char lenthtype[20]; - HDstrcpy(lenthtype, "fixed-length"); - if (expected_value == 1) - HDstrcpy(lenthtype, "variable-length"); - fprintf(stderr, "\nThe dataset '%s' should be %s but is not\n", table_name, lenthtype); - ret = FAIL; + if((vlen_check_result = H5Tdetect_class(dtype_id, H5T_VLEN)) < 0) + goto error; + + /* Check if length types match */ + if (vlen_check_result != (htri_t)uses_vlen_type) { + /* Give lengthtype "fixed-length" or "variable-length" depending on the + * expected_value passed in, then print the error message. + */ + char lenthtype[20]; + if (uses_vlen_type == TRUE) + HDstrcpy(lenthtype, "variable-length"); + else + HDstrcpy(lenthtype, "fixed-length"); + HDfprintf(stderr, "\nThe dataset '%s' should be %s but is not\n", table_name, lenthtype); + goto error; } /* Close the packet table */ if (H5PTclose(ptable) < 0) - goto error; + goto error; return SUCCEED; error: /* An error has occurred. Clean up and exit. */ - if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + if (H5PTis_valid(ptable) > 0) + H5PTclose(ptable); H5_FAILED(); return FAIL; } /* verify_accessors */ @@ -994,72 +990,73 @@ error: /* An error has occurred. Clean up and exit. */ * test_accessors(): Test the accessor functions * * Description: - * Retrieves the dataset and datatype IDs and verifies various info - * to ensure these IDs are correct. + * Retrieves the dataset and datatype IDs and verifies various info + * to ensure these IDs are correct. * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int test_accessors(void) { - hid_t fid=H5I_INVALID_HID; /* File identifier */ - herr_t ret = FAIL; /* Returned status from a callee */ + hid_t fid=H5I_INVALID_HID; /* File identifier */ + herr_t ret = FAIL; /* Returned status from a callee */ - TESTING("accessor functions"); + HL_TESTING2("accessor functions"); /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; ret = verify_accessors(fid, PT_VLEN_ATOMIC, TRUE); if (ret < 0) - goto error; + goto error; ret = verify_accessors(fid, PT_FIXED_LEN, FALSE); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; error: /* An error has occurred. Clean up and exit. */ - if (fid > 0) H5Fclose(fid); + if (fid > 0) + H5Fclose(fid); H5_FAILED(); return FAIL; } /* test_accessors */ /************************************************************************** - Test set for deprecated function H5PTcreate_fl - Each test in this set is the same as the corresponding one in the - set for H5PTcreate, as of Mar 2016 + Test set for deprecated function H5PTcreate_fl + Each test in this set is the same as the corresponding one in the + set for H5PTcreate, as of Mar 2016 **************************************************************************/ /*------------------------------------------------------------------------- * testfl_VLof_atomic(): Test that a packet table with VL datatypes of atomic - * datatypes can be created and written correctly. (HDFFV-442) + * datatypes can be created and written correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int testfl_VLof_atomic(void) { - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ - hsize_t count; /* Number of records in the table */ - unsigned uu, vv; /* Loop variables */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ - - TESTING3(" with vlen of atomic"); + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hsize_t count; /* Number of records in the table */ + unsigned uu, vv; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + HL_TESTING3(" with vlen of atomic"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -1067,42 +1064,42 @@ static int testfl_VLof_atomic(void) if (writeBuf[uu].p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].len = uu + 1; for (vv = 0; vv < (uu + 1); vv++) - ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv; + ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv; } /* end for */ /* Open the file */ fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a vlen type that uses an atomic datatype as its base type */ vltype = H5Tvlen_create (H5T_NATIVE_UINT); if (vltype < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of an atomic type */ ptable = H5PTcreate_fl(fid, PT_VLEN_ATOMIC, vltype, (hsize_t)1, 0); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Close the vlen datatype */ if (H5Tclose(vltype) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -1110,33 +1107,33 @@ static int testfl_VLof_atomic(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf ); if (ret < 0) - goto error; + goto error; for (uu = 0; uu < NRECORDS; uu++) for (vv = 0; vv < (uu + 1); vv++) { - if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { - printf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); - printf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); - } + if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { + printf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); + printf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); + } } /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf ); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -1153,7 +1150,7 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * testfl_VLof_comptype(): Test that a packet table with VL datatypes of - * compound datatypes can be created and written correctly. (HDFFV-442) + * compound datatypes can be created and written correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -1165,18 +1162,18 @@ static int testfl_VLof_comptype(void) unsigned u; float f; } VLcomp_t; - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ - hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - hsize_t count; /* Number of records in the table */ - unsigned uu, vv; /* Loop variables */ - char msg[80]; /* For error message */ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + hsize_t count; /* Number of records in the table */ + unsigned uu, vv; /* Loop variables */ + char msg[80]; /* For error message */ herr_t ret; - TESTING3(" with vlen of compound datatypes"); + HL_TESTING3(" with vlen of compound datatypes"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -1184,7 +1181,7 @@ static int testfl_VLof_comptype(void) if(writeBuf[uu].p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].len = uu + 1; for (vv = 0; vv < (uu + 1); vv++) { ((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv; @@ -1195,48 +1192,48 @@ static int testfl_VLof_comptype(void) /* Open the file */ fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create the base compound type */ cmptype = H5Tcreate(H5T_COMPOUND, sizeof(VLcomp_t)); if (cmptype < 0) - goto error; + goto error; /* Insert fields */ ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT); if (ret < 0) - goto error; + goto error; /* Create a variable length type that uses the VLcomp_t as its base type */ vltype = H5Tvlen_create(cmptype); if (vltype < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of compound datatype */ ptable = H5PTcreate_fl(fid, PT_VLEN_COMP, vltype, (hsize_t)1, 0); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release the datatypes */ if (H5Tclose(cmptype) < 0) - goto error; + goto error; if (H5Tclose(vltype) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)5, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -1244,39 +1241,39 @@ static int testfl_VLof_comptype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].len != readBuf[uu].len) { fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n",__LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len); - continue; - } /* write len != read len */ + continue; + } /* write len != read len */ for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) { fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv, ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]); continue; - } /* write value != read value */ - } + } /* write value != read value */ + } } /* end for */ /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -1294,8 +1291,8 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * testfl_compound_VL_VL(): Test that a packet table of compound datatypes - * containing VL datatypes can be created and written - * correctly. (HDFFV-442) + * containing VL datatypes can be created and written + * correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -1306,23 +1303,23 @@ static int testfl_compound_VL_VLtype(void) typedef struct { unsigned u; float f; - hvl_t v; + hvl_t v; } compVLVL_t; - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ - hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */ - hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing - a VL of VL of atomic datatype */ - hsize_t count; /* Number of records in the table */ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */ + hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing + a VL of VL of atomic datatype */ + hsize_t count; /* Number of records in the table */ compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */ compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */ hvl_t *t1, *t2; - unsigned uu, vv, ww; /* Loop variables */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ + unsigned uu, vv, ww; /* Loop variables */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ - TESTING3(" with compound datatype containing vlen datatype"); + HL_TESTING3(" with compound datatype containing vlen datatype"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -1332,15 +1329,15 @@ static int testfl_compound_VL_VLtype(void) if (writeBuf[uu].v.p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].v.len = uu + L1_INCM; for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++) - { + { t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int)); - if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); - goto error; - } + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + goto error; + } t1->len = vv + L2_INCM; for (ww = 0; ww < vv + L2_INCM; ww++) ((unsigned int*)t1->p)[ww] = uu * 100 + vv * 10 + ww; @@ -1350,58 +1347,58 @@ static int testfl_compound_VL_VLtype(void) /* Open the file */ fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a VL datatype of an atomic type */ vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); if (vlatomic < 0) - goto error; + goto error; /* Create a VL datatype of the VL of atomic datatype */ vlofvl = H5Tvlen_create (vlatomic); if (vlofvl < 0) - goto error; + goto error; /* Create the base compound type */ comp_vlvl = H5Tcreate(H5T_COMPOUND, sizeof(compVLVL_t)); if (comp_vlvl < 0) - goto error; + goto error; /* Insert fields: atomic, atomic, vlen */ ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(comp_vlvl, "v", HOFFSET(compVLVL_t, v), vlofvl); if (ret < 0) - goto error; + goto error; /* Create a packet table that uses a compound datatype of vlen datatype */ ptable = H5PTcreate_fl(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, 0); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release datatypes */ if (H5Tclose(vlatomic) < 0) - goto error; + goto error; if (H5Tclose(vlofvl) < 0) - goto error; + goto error; if (H5Tclose(comp_vlvl) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -1409,7 +1406,7 @@ static int testfl_compound_VL_VLtype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { @@ -1444,19 +1441,19 @@ static int testfl_compound_VL_VLtype(void) /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -1475,27 +1472,27 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * testfl_VLof_VLtype(): Test that a packet table of VL datatype with VL - * datatypes of atomic datatypes can be created and written - * correctly. (HDFFV-442) + * datatypes of atomic datatypes can be created and written + * correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int testfl_VLof_VLtype(void) { - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ - hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */ - hsize_t count; /* Number of records in the table */ - hvl_t *t1; /* pointer to advance */ - unsigned uu, vv, ww; /* Loop variables */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ - - TESTING3(" with vlen datatype of vlen datatype"); + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */ + hsize_t count; /* Number of records in the table */ + hvl_t *t1; /* pointer to advance */ + unsigned uu, vv, ww; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + HL_TESTING3(" with vlen datatype of vlen datatype"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -1506,12 +1503,12 @@ static int testfl_VLof_VLtype(void) } /* end if */ writeBuf[uu].len = uu + 1; for (t1 = (hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++) - { + { t1->p = HDmalloc((vv + 1) * sizeof(unsigned int)); - if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); - goto error; - } + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + goto error; + } t1->len = vv + 1; for (ww = 0; ww < (vv + 1); ww++) ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww; @@ -1521,39 +1518,39 @@ static int testfl_VLof_VLtype(void) /* Open the file */ fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a VL datatype of an atomic type */ vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); if (vlatomic < 0) - goto error; + goto error; vlofvl = H5Tvlen_create (vlatomic); if (vlofvl < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of vlen datatype */ ptable = H5PTcreate_fl(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, 0); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release datatypes */ if (H5Tclose(vlatomic) < 0) - goto error; + goto error; if (H5Tclose(vlofvl) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)5, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -1561,24 +1558,24 @@ static int testfl_VLof_VLtype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -1596,25 +1593,25 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * test_packet_table_with_varlen(): Invokes individual tests to ensure that - * packet tables with variable length are created and written correctly - * without the specific VL PT functionality. (HDFFV-442) + * packet tables with variable length are created and written correctly + * without the specific VL PT functionality. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ int test_packet_table_with_varlen(void) { - hid_t fid=H5I_INVALID_HID; /* File identifier */ + hid_t fid=H5I_INVALID_HID; /* File identifier */ int status = SUCCEED; /* Create a file using default properties */ fid = H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid < 0) - return FAIL; + return FAIL; /* Close the file. The file will be opened by each test function below */ if (H5Fclose(fid) < 0) - return FAIL; + return FAIL; HDputs("Testing packet table with various variable-length datatypes"); @@ -1623,46 +1620,46 @@ int test_packet_table_with_varlen(void) /* Test variable length of a simple type */ if (test_VLof_atomic() < 0) - status = FAIL; + status = FAIL; /* Test variable length of a compound type */ if (test_VLof_comptype() < 0) - status = FAIL; + status = FAIL; /* Test compound type with variable length */ if (test_compound_VL_VLtype() < 0) - status = FAIL; + status = FAIL; /* Test variable length of a variable length */ if (test_VLof_VLtype() < 0) - status = FAIL; + status = FAIL; /* Test variable length of a variable length */ if (test_H5PTis_varlen() < 0) - status = FAIL; + status = FAIL; /* Test adding attributes to packet table */ if (test_attributes() < 0) - status = FAIL; + status = FAIL; /* Test accessor functions */ if (test_accessors() < 0) - status = FAIL; + status = FAIL; /************************************************************************** - Calling test functions for deprecated function H5PTcreate_fl - Mar 2016, -BMR + Calling test functions for deprecated function H5PTcreate_fl + Mar 2016, -BMR **************************************************************************/ /* Create a file using default properties */ fid = H5Fcreate(TESTFL_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid < 0) - return FAIL; + return FAIL; /* Close the file. The file will be opened by each test function below */ if (H5Fclose(fid) < 0) - return FAIL; + return FAIL; HDputs("Testing packet table with various variable-length datatypes - H5PTcreate_fl"); @@ -1671,19 +1668,19 @@ int test_packet_table_with_varlen(void) /* Test variable length of a simple type */ if (testfl_VLof_atomic() < 0) - status = FAIL; + status = FAIL; /* Test variable length of a compound type */ if (testfl_VLof_comptype() < 0) - status = FAIL; + status = FAIL; /* Test compound type with variable length */ if (testfl_compound_VL_VLtype() < 0) - status = FAIL; + status = FAIL; /* Test variable length of a variable length */ if (testfl_VLof_VLtype() < 0) - status = FAIL; + status = FAIL; return(status); } diff --git a/hl/test/test_table.c b/hl/test/test_table.c index ff9c0eb..1d6bcec 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -51,8 +51,6 @@ #define NRECORDS 8 #define NRECORDS_ADD 3 -#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);} - /*------------------------------------------------------------------------- * structure used for all tests, a particle with properties *------------------------------------------------------------------------- @@ -117,7 +115,7 @@ typedef struct particle3_t *------------------------------------------------------------------------- */ -/* Push current alignment rule forcing 4-byte alignment boundary +/* Push current alignment rule forcing 4-byte alignment boundary * to the internal stack ... */ #pragma pack(push,4) @@ -129,7 +127,7 @@ typedef struct particle3_t float aty[3]; float rro[2]; } particle4_t; -/* +/* * ... and restore original alignment rules from stack */ #pragma pack(pop) @@ -143,16 +141,7 @@ static hid_t h5file_open(const char *fname, unsigned flags) { hid_t fid; /* identifier for the file */ - char *srcdir = getenv("srcdir"); /* the source directory */ - char data_file[512]=""; /* buffer to hold name of existing file */ - - /* compose the name of the file to open, using the srcdir, if appropriate */ - if (srcdir) - { - HDstrcpy(data_file,srcdir); - HDstrcat(data_file,"/"); - } - HDstrcat(data_file,fname); + const char *data_file = H5_get_srcdir_filename(fname); /* open */ if ((fid = H5Fopen(data_file,flags,H5P_DEFAULT))<0) @@ -173,14 +162,14 @@ static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf ) if ( ( HDstrcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || rbuf[i].lati != wbuf[j].lati || rbuf[i].longi != wbuf[j].longi || - !FLT_ABS_EQUAL(rbuf[i].pressure,wbuf[j].pressure) || - !DBL_ABS_EQUAL(rbuf[i].temperature,wbuf[j].temperature) ) + !H5_FLT_ABS_EQUAL(rbuf[i].pressure,wbuf[j].pressure) || + !H5_DBL_ABS_EQUAL(rbuf[i].temperature,wbuf[j].temperature) ) { HDfprintf(stderr,"read and write buffers have differences\n"); HDfprintf(stderr,"%s %ld %f %f %d\n", - rbuf[i].name,rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].temperature,rbuf[i].lati); + rbuf[i].name,rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].temperature,rbuf[i].lati); HDfprintf(stderr,"%s %ld %f %f %d\n", - wbuf[j].name,wbuf[j].longi,(double)wbuf[j].pressure,wbuf[j].temperature,wbuf[j].lati); + wbuf[j].name,wbuf[j].longi,(double)wbuf[j].pressure,wbuf[j].temperature,wbuf[j].lati); return -1; } return 0; @@ -433,7 +422,7 @@ static int test_table(hid_t fid, int do_write) sizeof( rbuf[0].lati) }; - const char *field_names4[NFIELDS+1] = + const char *field_names4[NFIELDS+1] = { "F1", "F2", "F3", "F4", "F5", "F6"}; hid_t field_type4[NFIELDS+1]; particle4_t fill_data[1] = { {9999999, -9999999, 999999, {999,999,999},{999,999,999}, {999,999}} }; @@ -467,7 +456,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("making table"); + HL_TESTING2("making table"); if (H5TBmake_table(TITLE,fid,"table1",FIELDS,RECORDS,type_size_mem, field_names,field_offset,field_type, @@ -476,7 +465,7 @@ static int test_table(hid_t fid, int do_write) PASSED(); } - TESTING2("reading table"); + HL_TESTING2("reading table"); /*------------------------------------------------------------------------- * read the table @@ -506,7 +495,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("writing records"); + HL_TESTING2("writing records"); /* create an empty table */ if (H5TBmake_table(TITLE,fid,"table2",FIELDS,RECORDS,type_size_mem, @@ -549,7 +538,7 @@ static int test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ - TESTING2("reading records"); + HL_TESTING2("reading records"); /*------------------------------------------------------------------------- * read records, start at 0, read 8 @@ -593,7 +582,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("appending records"); + HL_TESTING2("appending records"); /*------------------------------------------------------------------------- * append 2 records @@ -639,7 +628,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("inserting records"); + HL_TESTING2("inserting records"); /*------------------------------------------------------------------------- * insert 2 records @@ -699,7 +688,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("deleting records"); + HL_TESTING2("deleting records"); /*------------------------------------------------------------------------- * Create a table @@ -892,54 +881,54 @@ static int test_table(hid_t fid, int do_write) /*------------------------------------------------------------------------ * Functions tested: * - * H5TBdelete_record -- With differing memory layout from machine memory + * H5TBdelete_record -- With differing memory layout from machine memory * layout. HDFFV-8055 * *------------------------------------------------------------------------- */ if (do_write) { - TESTING2("deleting records (differing memory layout)"); + HL_TESTING2("deleting records (differing memory layout)"); - dims = 3; - arry3_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); + dims = 3; + arry3_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); - dims = 2; - arry2_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); + dims = 2; + arry2_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); - /* Initialize the field field_type */ - field_type4[0] = H5T_NATIVE_UINT32; - field_type4[1] = H5T_NATIVE_DOUBLE; - field_type4[2] = H5T_NATIVE_DOUBLE; - field_type4[3] = arry3_32f; - field_type4[4] = arry3_32f; - field_type4[5] = arry2_32f; + /* Initialize the field field_type */ + field_type4[0] = H5T_NATIVE_UINT32; + field_type4[1] = H5T_NATIVE_DOUBLE; + field_type4[2] = H5T_NATIVE_DOUBLE; + field_type4[3] = arry3_32f; + field_type4[4] = arry3_32f; + field_type4[5] = arry2_32f; - /* Make the table */ - if (H5TBmake_table("Table Title",fid,"table",NFIELDS+1,(hsize_t)NRECORDS, + /* Make the table */ + if (H5TBmake_table("Table Title",fid,"table",NFIELDS+1,(hsize_t)NRECORDS, tbl_size, field_names4, tbl_offset, field_type4, chunk_size, fill_data, compress, p_data)<0) - goto out; - /* Delete records */ - start = 3; - nrecords = 3; - if (H5TBdelete_record(fid, "table", start, nrecords)<0) - goto out;; - /* Get table info */ - if (H5TBget_table_info(fid,"table", &nfields_out, &nrecords_out)<0) - goto out; - /* check */ - if( (int)nfields_out != (int)NFIELDS+1) - goto out; - - if( (int)nrecords_out != (int)NRECORDS-3) - goto out; - - /* close type */ - H5Tclose(arry3_32f); - H5Tclose(arry2_32f); - - PASSED(); + goto out; + /* Delete records */ + start = 3; + nrecords = 3; + if (H5TBdelete_record(fid, "table", start, nrecords)<0) + goto out;; + /* Get table info */ + if (H5TBget_table_info(fid,"table", &nfields_out, &nrecords_out)<0) + goto out; + /* check */ + if( (int)nfields_out != (int)NFIELDS+1) + goto out; + + if( (int)nrecords_out != (int)NRECORDS-3) + goto out; + + /* close type */ + H5Tclose(arry3_32f); + H5Tclose(arry2_32f); + + PASSED(); } /*------------------------------------------------------------------------- @@ -954,7 +943,7 @@ static int test_table(hid_t fid, int do_write) if (do_write) { - TESTING2("adding records"); + HL_TESTING2("adding records"); /* create 2 tables */ if (H5TBmake_table(TITLE,fid,"table4",FIELDS,RECORDS,type_size_mem, @@ -1014,7 +1003,7 @@ static int test_table(hid_t fid, int do_write) if (do_write) { - TESTING2("combining tables"); + HL_TESTING2("combining tables"); /* create 2 tables */ if (H5TBmake_table(TITLE,fid,"table6",FIELDS,RECORDS,type_size_mem, @@ -1109,7 +1098,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("writing fields by name"); + HL_TESTING2("writing fields by name"); /* make an empty table with fill values */ if (H5TBmake_table(TITLE,fid,"table9",FIELDS,RECORDS,type_size_mem, @@ -1147,10 +1136,10 @@ static int test_table(hid_t fid, int do_write) { if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati || rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi || - !FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) ) + !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) ) { HDfprintf(stderr,"%ld %f %d\n", - rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].lati); + rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].lati); HDfprintf(stderr,"%ld %f %d\n", position_in[i].longi,(double)pressure_in[i],position_in[i].lati); goto out; @@ -1172,7 +1161,7 @@ static int test_table(hid_t fid, int do_write) * *------------------------------------------------------------------------- */ - TESTING2("reading fields by name"); + HL_TESTING2("reading fields by name"); /*------------------------------------------------------------------------- * write and read the "Pressure" field @@ -1200,7 +1189,7 @@ static int test_table(hid_t fid, int do_write) if ( H5TBread_fields_name(fid,"table10","DoesNotExist",start,nrecords, sizeof(float),0,field_sizes_pre,pressure_out) >=0) goto out; - + /* read the "Pressure" field */ if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords, sizeof(float),0,field_sizes_pre,pressure_out)<0) @@ -1209,7 +1198,7 @@ static int test_table(hid_t fid, int do_write) /* Compare the extracted table with the initial values */ for ( i = 0; i < NRECORDS; i++ ) { - if ( !FLT_ABS_EQUAL(pressure_out[i], pressure_in[i]) ) { + if ( !H5_FLT_ABS_EQUAL(pressure_out[i], pressure_in[i]) ) { goto out; } } @@ -1272,7 +1261,7 @@ static int test_table(hid_t fid, int do_write) for( i = 0; i < NRECORDS; i++ ) { if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || - !FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) { + !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) { goto out; } } @@ -1301,7 +1290,7 @@ static int test_table(hid_t fid, int do_write) { hsize_t iistart = start; if ( ( HDstrcmp( namepre_out[i].name, namepre_in[iistart+i].name ) != 0 ) || - !FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[iistart+i].pressure) ) { + !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[iistart+i].pressure) ) { goto out; } } @@ -1320,7 +1309,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("writing fields by index"); + HL_TESTING2("writing fields by index"); /* make an empty table */ if (H5TBmake_table(TITLE,fid,"table11",FIELDS,RECORDS,type_size_mem, @@ -1360,7 +1349,7 @@ static int test_table(hid_t fid, int do_write) { if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati || rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi || - !FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) ) + !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) ) goto out; } } @@ -1378,7 +1367,7 @@ static int test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ - TESTING2("reading fields by index"); + HL_TESTING2("reading fields by index"); if (do_write) { @@ -1413,7 +1402,7 @@ static int test_table(hid_t fid, int do_write) /* compare the extracted table with the initial values */ for( i = 0; i < NRECORDS; i++ ) { - if ( !FLT_ABS_EQUAL(pressure_out[i], pressure_in[i]) ) { + if ( !H5_FLT_ABS_EQUAL(pressure_out[i], pressure_in[i]) ) { goto out; } } @@ -1479,8 +1468,8 @@ static int test_table(hid_t fid, int do_write) for( i = 0; i < NRECORDS; i++ ) { if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || - !FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) { - goto out; + !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) { + goto out; } } @@ -1510,7 +1499,7 @@ static int test_table(hid_t fid, int do_write) { int iistart = (int) start; if ( ( HDstrcmp( namepre_out[i].name, wbuf[iistart+(int)i].name ) != 0 ) || - !FLT_ABS_EQUAL(namepre_out[i].pressure, wbuf[iistart+(int)i].pressure) ) { + !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, wbuf[iistart+(int)i].pressure) ) { goto out; } } @@ -1529,7 +1518,7 @@ static int test_table(hid_t fid, int do_write) if (do_write) { - TESTING2("inserting fields"); + HL_TESTING2("inserting fields"); /* make a table */ if (H5TBmake_table(TITLE,fid,"table13",FIELDS,RECORDS,type_size_mem, @@ -1553,8 +1542,8 @@ static int test_table(hid_t fid, int do_write) if ( ( HDstrcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) || rbuf2[i].lati != wbuf[i].lati || rbuf2[i].longi != wbuf[i].longi || - !FLT_ABS_EQUAL(rbuf2[i].pressure,wbuf[i].pressure) || - !DBL_ABS_EQUAL(rbuf2[i].temperature,wbuf[i].temperature) || + !H5_FLT_ABS_EQUAL(rbuf2[i].pressure,wbuf[i].pressure) || + !H5_DBL_ABS_EQUAL(rbuf2[i].temperature,wbuf[i].temperature) || rbuf2[i].new_field != buf_new[i] ) { goto out; } @@ -1572,7 +1561,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("deleting fields"); + HL_TESTING2("deleting fields"); /* make a table */ if (H5TBmake_table(TITLE,fid,"table14",FIELDS,RECORDS,type_size_mem, @@ -1594,7 +1583,7 @@ static int test_table(hid_t fid, int do_write) if ( ( HDstrcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) || rbuf3[i].lati != wbuf[i].lati || rbuf3[i].longi != wbuf[i].longi || - !DBL_ABS_EQUAL(rbuf3[i].temperature,wbuf[i].temperature) ) { + !H5_DBL_ABS_EQUAL(rbuf3[i].temperature,wbuf[i].temperature) ) { goto out; } } @@ -1612,7 +1601,7 @@ static int test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ - TESTING2("getting table info"); + HL_TESTING2("getting table info"); /* get table info */ if ( H5TBget_table_info (fid, "table1", &rfields, &rrecords ) < 0 ) @@ -1633,7 +1622,7 @@ static int test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ - TESTING2("getting field info"); + HL_TESTING2("getting field info"); /* alocate */ names_out = (char**) HDmalloc( sizeof(char*) * (size_t)NFIELDS ); |