From 2ba7b8f5e0c406376d90b344dadee385e69ca987 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Wed, 19 Jun 2019 17:13:54 -0500 Subject: Fix failing automated reporting. Add 8-bit big-endian testfile. --- tools/test/h5repack/CMakeTests.cmake | 13 ++ tools/test/h5repack/h5repack.sh.in | 12 +- tools/test/h5repack/h5repackgentest.c | 160 ++++++++++++++++++--- tools/test/h5repack/testfiles/h5repack_int32le.h5 | Bin 4096 -> 4096 bytes .../test/h5repack/testfiles/h5repack_int32le_ex.h5 | Bin 1472 -> 1472 bytes tools/test/h5repack/testfiles/h5repack_uint8be.h5 | Bin 0 -> 2560 bytes .../h5repack/testfiles/h5repack_uint8be_ex-0.dat | Bin 0 -> 64 bytes .../h5repack/testfiles/h5repack_uint8be_ex-1.dat | 1 + .../h5repack/testfiles/h5repack_uint8be_ex-2.dat | 1 + .../h5repack/testfiles/h5repack_uint8be_ex-3.dat | 1 + .../h5repack/testfiles/h5repack_uint8be_ex-4.dat | Bin 0 -> 64 bytes .../h5repack/testfiles/h5repack_uint8be_ex-5.dat | Bin 0 -> 64 bytes .../h5repack/testfiles/h5repack_uint8be_ex-6.dat | Bin 0 -> 64 bytes .../h5repack/testfiles/h5repack_uint8be_ex-7.dat | Bin 0 -> 64 bytes .../test/h5repack/testfiles/h5repack_uint8be_ex.h5 | Bin 0 -> 1912 bytes 15 files changed, 164 insertions(+), 24 deletions(-) create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 7dbf2a1..f6cf9bf 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -30,6 +30,9 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fletcher.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_hlink.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_ex.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_ex-0.dat ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layouto.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout2.h5 @@ -51,6 +54,16 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_none.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_paged_nopersist.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_paged_persist.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-0.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-1.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-2.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-3.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-4.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-5.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-6.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-7.dat # h5diff/testfile ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5 # tools/testfiles diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 56df3c8..04f04f2 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -625,17 +625,19 @@ DIFFFAIL() # Catchall test for repacking with external files # Loops over all (internally-listed) cases and applies the given arguments # to h5repack. +# Each test file family must be listed in the for loop at the start of the +# 'function'. # Expects case files to be of format: # + h5repack_.h5 # + h5repack__ex.h5 # + h5repack__ex-.dat # ...where NAME is part of the internal list, and N is a positive decimal # number; multiple external files (*.dat) are allowed per file, but they must -# follow the same pattern and be in numerical sequence starting at 0. +# follow the pattern and be in contiguous numerical sequence starting at 0. # ----------------------------------------------------------------------------- VERIFY_EXTERNAL_CONSOLIDATION() { - for name in int32le + for name in int32le uint8be do basename="h5repack_${name}" base_ext="${basename}_ex" @@ -1551,10 +1553,10 @@ VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5 # -j 0 -k 1, file cannot be opened VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5 -# +######################################## # Testing external storage -# -VERIFY_EXTERNAL_CONSOLIDATION +######################################## +VERIFY_EXTERNAL_CONSOLIDATION -l CONTI # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 0eec88c..27f6009 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -1,26 +1,50 @@ #include "hdf5.h" #include "H5private.h" +/* For generating files for verifying h5repack with external storage. . . + * + * Each case file should follow the format of: + * + h5repack_.h5 + * + h5repack__ex.h5 + * + h5repack__ex-.dat + * ...where NAME idenfities the type, and N is a positive decimal number; + * multiple external files (*.dat) are allowed per file, but they must + * follow the pattern and be in contiguous numerical sequence starting at 0. + * + * Each file typename must be added to the listing for + * `VERIFY_EXTERNAL_CONSOLIDATION` in h5repack.sh + * + * There is no restriction on the name, number, or structure of datasets and + * groups in HDF5 file. + * + * The generated files will need to be moved "by hand" into the testfiles + * directory. (TODO) + */ + #define MAX_NAME_SIZE 256 #define FILE_INT32LE "h5repack_int32le" +#define FILE_UINT8BE "h5repack_uint8be" /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * TODO: error handling is a joke, but this seems normal for the tools' + * gentest operations. */ static void generate_int32le(hbool_t external) { char filename[MAX_NAME_SIZE]; hid_t file; - hid_t dspace; hid_t dset; hid_t dcpl = H5P_DEFAULT; + hid_t dspace; hsize_t dims[] = {8, 8, 8}; int32_t wdata[512]; /* 8^3 */ int32_t n; int i; int j; int k; + herr_t ret; /* error-checking */ /* generate values, alternating positive and negative */ @@ -35,20 +59,21 @@ generate_int32le(hbool_t external) FILE_INT32LE, (external) ? "_ex" : ""); - file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - HDassert(file >= 0); - - dspace = H5Screate_simple(3, dims, NULL); - HDassert(dspace >= 0); - if (external) { char name[MAX_NAME_SIZE]; dcpl = H5Pcreate(H5P_DATASET_CREATE); - HDassert(dcpl >= 0); + HDassert(dcpl != H5I_INVALID_HID); snprintf(name, MAX_NAME_SIZE, "%s_ex-0.dat", FILE_INT32LE); - HDassert(H5Pset_external(dcpl, name, 0, H5F_UNLIMITED) >= 0); + ret = H5Pset_external(dcpl, name, 0, H5F_UNLIMITED); + HDassert(ret >= 0); } + dspace = H5Screate_simple(3, dims, NULL); + HDassert(dspace != H5I_INVALID_HID); + + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(file != H5I_INVALID_HID); + dset = H5Dcreate2( file, "dset", @@ -57,26 +82,123 @@ generate_int32le(hbool_t external) H5P_DEFAULT, dcpl, H5P_DEFAULT); - HDassert(dset >= 0); + HDassert(dset != H5I_INVALID_HID); - HDassert(H5Dwrite(dset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) - >= 0); + ret = H5Dwrite( + dset, + H5T_STD_I32LE, + H5S_ALL, + H5S_ALL, + H5P_DEFAULT, + wdata); + HDassert(ret >= 0); + + if (dcpl != H5P_DEFAULT) { + ret = H5Pclose(dcpl); + HDassert(ret >= 0); + } + ret = H5Dclose(dset); + HDassert(ret >= 0); + ret = H5Fclose(file); + HDassert(ret >= 0); + ret = H5Sclose(dspace); + HDassert(ret >= 0); - if (external) - HDassert(H5Pclose(dcpl) >= 0); - HDassert(H5Dclose(dset) >= 0); - HDassert(H5Sclose(dspace) >= 0); - HDassert(H5Fclose(file) >= 0); } /* end generate_int32le() */ +static void +generate_uint8be(hbool_t external) +{ + char filename[MAX_NAME_SIZE]; + hid_t file; + hid_t dset; + hid_t dcpl = H5P_DEFAULT; + hid_t dspace; + hsize_t dims[] = {8, 8, 8}; + uint8_t wdata[512]; /* 8^3 */ + uint8_t n; + int i; + int j; + int k; + herr_t ret; /* error-checking */ + + /* Generate values, alternating positive and negative + * The latter half of the dataset is "overflow garbage" (TODO?) + */ + for (i=0, n=0; i < 8; i++) + for (j=0; j < 8; j++) + for (k=0; k < 8; k++, n++) + wdata[n] = n * ((n&1) ? (-1) : (1)); + + snprintf(filename, + MAX_NAME_SIZE, + "%s%s.h5", + FILE_UINT8BE, + (external) ? "_ex" : ""); + + if (external) { + char name[MAX_NAME_SIZE]; + dcpl = H5Pcreate(H5P_DATASET_CREATE); + HDassert(dcpl != H5I_INVALID_HID); + for (i = 0; i < 8; i++) { + snprintf(name, MAX_NAME_SIZE, "%s_ex-%d.dat", FILE_UINT8BE, i); + ret = H5Pset_external(dcpl, name, 0, 64 * sizeof(char)); + HDassert(ret >= 0); + } + } + + dspace = H5Screate_simple(3, dims, NULL); + HDassert(dspace != H5I_INVALID_HID); + + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(file != H5I_INVALID_HID); + + dset = H5Dcreate2( + file, + "dset", + H5T_STD_U8BE, + dspace, + H5P_DEFAULT, + dcpl, + H5P_DEFAULT); + HDassert(dset != H5I_INVALID_HID); + + ret = H5Dwrite( + dset, + H5T_STD_U8BE, + H5S_ALL, + H5S_ALL, + H5P_DEFAULT, + wdata); + HDassert(ret >= 0); + + if (dcpl != H5P_DEFAULT) { + ret = H5Pclose(dcpl); + HDassert(ret >= 0); + } + ret = H5Dclose(dset); + HDassert(ret >= 0); + ret = H5Fclose(file); + HDassert(ret >= 0); + ret = H5Sclose(dspace); + HDassert(ret >= 0); + +} /* end generate_uint8be() */ + + /* ---------------------------------------------------------------------------- */ int main(void) { - generate_int32le(FALSE); - generate_int32le(TRUE); + int i; + + for (i=0; i < 2; i++) { + hbool_t external = (i&1) ? TRUE : FALSE; + generate_int32le(external); + generate_uint8be(external); + } return 0; } /* end main() */ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le.h5 b/tools/test/h5repack/testfiles/h5repack_int32le.h5 index fb00579..4e9500f 100644 Binary files a/tools/test/h5repack/testfiles/h5repack_int32le.h5 and b/tools/test/h5repack/testfiles/h5repack_int32le.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 index 337b297..8c8b644 100644 Binary files a/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 and b/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be.h5 b/tools/test/h5repack/testfiles/h5repack_uint8be.h5 new file mode 100644 index 0000000..f89bc03 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat new file mode 100644 index 0000000..f95b90a Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat new file mode 100644 index 0000000..011ab48 --- /dev/null +++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat @@ -0,0 +1 @@ +@¿B½D»F¹H·JµL³N±P¯R­T«V©X§Z¥\£^¡`Ÿbd›f™h—j•l“n‘prt‹v‰x‡z…|ƒ~ \ No newline at end of file diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat new file mode 100644 index 0000000..069b96d --- /dev/null +++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat @@ -0,0 +1 @@ +€‚}„{†yˆwŠuŒsŽqo’m”k–i˜gšeœcža _¢]¤[¦Y¨WªU¬S®Q°O²M´K¶I¸GºE¼C¾A \ No newline at end of file diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat new file mode 100644 index 0000000..240d8ca --- /dev/null +++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat @@ -0,0 +1 @@ +À?Â=Ä;Æ9È7Ê5Ì3Î1Ð/Ò-Ô+Ö)Ø'Ú%Ü#Þ!àâäæèêìîðò ô ö øúüþ \ No newline at end of file diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat new file mode 100644 index 0000000..b5c4e7c Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat new file mode 100644 index 0000000..b77f32c Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat new file mode 100644 index 0000000..1e335eb Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat new file mode 100644 index 0000000..3dadb7d Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 b/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 new file mode 100644 index 0000000..6f8c3fe Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 differ -- cgit v0.12