From 363c5e67a5b2c2f7e53af6c89f337dcf01fbb47e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 20 Jan 2017 15:49:43 -0600 Subject: HDFFV-10118 port plugin tools test fix to 1.8 --- tools/h5diff/dynlib_diff.c | 57 +++++++++++++++++------------------ tools/h5diff/testfiles/tudfilter.h5 | Bin 4816 -> 4816 bytes tools/h5diff/testfiles/tudfilter2.h5 | Bin 4816 -> 4816 bytes tools/h5dump/dynlib_dump.c | 57 +++++++++++++++++------------------ tools/h5dump/h5dumpgentest.c | 55 ++++++++++++++++++++------------- tools/h5ls/CMakeTests.cmake | 4 +-- tools/h5ls/dynlib_ls.c | 57 +++++++++++++++++------------------ tools/h5ls/h5ls_plugin.sh.in | 2 +- tools/testfiles/tudfilter.h5 | Bin 4816 -> 4816 bytes tools/testfiles/tudfilter.ls | 28 ++++------------- 10 files changed, 124 insertions(+), 136 deletions(-) diff --git a/tools/h5diff/dynlib_diff.c b/tools/h5diff/dynlib_diff.c index 0d8be2b..d80777d 100644 --- a/tools/h5diff/dynlib_diff.c +++ b/tools/h5diff/dynlib_diff.c @@ -12,59 +12,52 @@ * to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu - * 13 February 2013 - * - * Purpose: Tests the plugin module (H5PL) + * Purpose: Tests the plugin module (H5PL) */ #include #include #include "H5PLextern.h" -#define H5Z_FILTER_DYNLIB2 258 +#define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 -static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, +static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB2[1] = {{ +const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB2, /* Filter id number */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ - "dynlib2", /* Filter name for debugging */ + "dynlibud", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */ + (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;} /*------------------------------------------------------------------------- - * Function: H5Z_filter_dynlib2 + * Function: H5Z_filter_dynlibud * - * Purpose: A dynlib2 filter method that multiplies the original value + * Purpose: A dynlib2 filter method that multiplies the original value * during write and divide the original value during read. It - * will be built as a shared library. plugin.c test will load - * and use this filter library. - * - * Return: Success: Data chunk size - * - * Failure: 0 + * will be built as a shared library. plugin.c test will load + * and use this filter library. * - * Programmer: Raymond Lu - * 29 March 2013 + * Return: Success: Data chunk size * + * Failure: 0 *------------------------------------------------------------------------- */ static size_t -H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, +H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf) { - int *int_ptr = (int *)*buf; /* Pointer to the data values */ + char *int_ptr = (char *)*buf; /* Pointer to the data values */ size_t buf_left = *buf_size; /* Amount of data buffer left to process */ /* Check for the correct number of parameters */ @@ -75,20 +68,24 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, cd_values = cd_values; if(flags & H5Z_FLAG_REVERSE) { /*read*/ - /* Divide the original value with MULTIPLIER */ + /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { - *int_ptr++ /= MULTIPLIER; - buf_left -= sizeof(int); + char temp = *int_ptr; + *int_ptr = temp - MULTIPLIER; + int_ptr++; + buf_left -= sizeof(*int_ptr); } /* end while */ } /* end if */ else { /*write*/ - /* Multiply the original value with MULTIPLIER */ + /* Add the original value with MULTIPLIER */ while(buf_left > 0) { - *int_ptr++ *= MULTIPLIER; - buf_left -= sizeof(int); + char temp = *int_ptr; + *int_ptr = temp + MULTIPLIER; + int_ptr++; + buf_left -= sizeof(*int_ptr); } /* end while */ } /* end else */ return nbytes; -} /* end H5Z_filter_dynlib2() */ +} /* end H5Z_filter_dynlibud() */ diff --git a/tools/h5diff/testfiles/tudfilter.h5 b/tools/h5diff/testfiles/tudfilter.h5 index a1f6d80..a61a954 100644 Binary files a/tools/h5diff/testfiles/tudfilter.h5 and b/tools/h5diff/testfiles/tudfilter.h5 differ diff --git a/tools/h5diff/testfiles/tudfilter2.h5 b/tools/h5diff/testfiles/tudfilter2.h5 index a1f6d80..a61a954 100644 Binary files a/tools/h5diff/testfiles/tudfilter2.h5 and b/tools/h5diff/testfiles/tudfilter2.h5 differ diff --git a/tools/h5dump/dynlib_dump.c b/tools/h5dump/dynlib_dump.c index 0d8be2b..d80777d 100644 --- a/tools/h5dump/dynlib_dump.c +++ b/tools/h5dump/dynlib_dump.c @@ -12,59 +12,52 @@ * to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu - * 13 February 2013 - * - * Purpose: Tests the plugin module (H5PL) + * Purpose: Tests the plugin module (H5PL) */ #include #include #include "H5PLextern.h" -#define H5Z_FILTER_DYNLIB2 258 +#define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 -static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, +static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB2[1] = {{ +const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB2, /* Filter id number */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ - "dynlib2", /* Filter name for debugging */ + "dynlibud", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */ + (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;} /*------------------------------------------------------------------------- - * Function: H5Z_filter_dynlib2 + * Function: H5Z_filter_dynlibud * - * Purpose: A dynlib2 filter method that multiplies the original value + * Purpose: A dynlib2 filter method that multiplies the original value * during write and divide the original value during read. It - * will be built as a shared library. plugin.c test will load - * and use this filter library. - * - * Return: Success: Data chunk size - * - * Failure: 0 + * will be built as a shared library. plugin.c test will load + * and use this filter library. * - * Programmer: Raymond Lu - * 29 March 2013 + * Return: Success: Data chunk size * + * Failure: 0 *------------------------------------------------------------------------- */ static size_t -H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, +H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf) { - int *int_ptr = (int *)*buf; /* Pointer to the data values */ + char *int_ptr = (char *)*buf; /* Pointer to the data values */ size_t buf_left = *buf_size; /* Amount of data buffer left to process */ /* Check for the correct number of parameters */ @@ -75,20 +68,24 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, cd_values = cd_values; if(flags & H5Z_FLAG_REVERSE) { /*read*/ - /* Divide the original value with MULTIPLIER */ + /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { - *int_ptr++ /= MULTIPLIER; - buf_left -= sizeof(int); + char temp = *int_ptr; + *int_ptr = temp - MULTIPLIER; + int_ptr++; + buf_left -= sizeof(*int_ptr); } /* end while */ } /* end if */ else { /*write*/ - /* Multiply the original value with MULTIPLIER */ + /* Add the original value with MULTIPLIER */ while(buf_left > 0) { - *int_ptr++ *= MULTIPLIER; - buf_left -= sizeof(int); + char temp = *int_ptr; + *int_ptr = temp + MULTIPLIER; + int_ptr++; + buf_left -= sizeof(*int_ptr); } /* end while */ } /* end else */ return nbytes; -} /* end H5Z_filter_dynlib2() */ +} /* end H5Z_filter_dynlibud() */ diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 284e42b..72eb2e0 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -153,21 +153,21 @@ const H5Z_class2_t H5Z_MYFILTER[1] = {{ myfilter, /* The actual filter function */ }}; -#define H5Z_FILTER_DYNLIB2 258 +#define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 -static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, +static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB2[1] = {{ +const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB2, /* Filter id number */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ - "dynlib2", /* Filter name for debugging */ + "dynlibud", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */ + (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ }}; @@ -10160,6 +10160,7 @@ static void gent_udfilter(void) { hid_t fid; /* file id */ hid_t dcpl; /* dataset creation property list */ + hid_t dsid; /* dataset ID */ hid_t sid; /* dataspace ID */ hid_t tid; /* datatype ID */ @@ -10190,13 +10191,22 @@ static void gent_udfilter(void) ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); HDassert(ret >= 0); - ret = H5Zregister (H5Z_DYNLIB2); + ret = H5Zregister (H5Z_DYNLIBUD); HDassert(ret >= 0); - ret = H5Pset_filter (dcpl, H5Z_FILTER_DYNLIB2, H5Z_FLAG_MANDATORY, 0, NULL); + ret = H5Pset_filter (dcpl, H5Z_FILTER_DYNLIBUD, H5Z_FLAG_MANDATORY, 0, NULL); HDassert(ret >= 0); - ret=make_dset(fid, "dynlib2", sid, H5T_NATIVE_INT, dcpl, buf1); + /* create the dataset */ + dsid = H5Dcreate2(fid, "dynlibud", H5T_STD_I32LE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + HDassert(dsid >= 0); + + /* write */ + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1); + HDassert(ret >= 0); + + /* close */ + ret = H5Dclose(dsid); HDassert(ret >= 0); /* remove the filters from the dcpl */ @@ -10218,9 +10228,9 @@ static void gent_udfilter(void) } /*------------------------------------------------------------------------- - * Function: H5Z_filter_dynlib2 + * Function: H5Z_filter_dynlibud * - * Purpose: A dynlib2 filter method that multiplies the original value + * Purpose: A dynlibud filter method that multiplies the original value * during write and divide the original value during read. It * will be built as a shared library. tools tests will load * and use this filter as a plugin library. @@ -10231,11 +10241,11 @@ static void gent_udfilter(void) *------------------------------------------------------------------------- */ static size_t -H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, +H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf) { - int *int_ptr = (int *)*buf; /* Pointer to the data values */ + char *int_ptr = (char *)*buf; /* Pointer to the data values */ size_t buf_left = *buf_size; /* Amount of data buffer left to process */ /* Check for the correct number of parameters */ @@ -10246,23 +10256,26 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, cd_values = cd_values; if(flags & H5Z_FLAG_REVERSE) { /*read*/ - /* Divide the original value with MULTIPLIER */ + /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { - *int_ptr++ /= MULTIPLIER; - buf_left -= sizeof(int); + char temp = *int_ptr; + *int_ptr = temp - MULTIPLIER; + int_ptr++; + buf_left -= sizeof(*int_ptr); } /* end while */ } /* end if */ else { /*write*/ - /* Multiply the original value with MULTIPLIER */ + /* Add the original value with MULTIPLIER */ while(buf_left > 0) { - *int_ptr++ *= MULTIPLIER; - buf_left -= sizeof(int); + char temp = *int_ptr; + *int_ptr = temp + MULTIPLIER; + int_ptr++; + buf_left -= sizeof(*int_ptr); } /* end while */ } /* end else */ return nbytes; -} /* end H5Z_filter_dynlib2() */ - +} /* end H5Z_filter_dynlibud() */ /*------------------------------------------------------------------------- * Function: main diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake index f790ed9..1646fa9 100644 --- a/tools/h5ls/CMakeTests.cmake +++ b/tools/h5ls/CMakeTests.cmake @@ -434,5 +434,5 @@ ############################################################################## ### P L U G I N T E S T S ############################################################################## -ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -v -d tudfilter.h5) - \ No newline at end of file +ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -d tudfilter.h5) + diff --git a/tools/h5ls/dynlib_ls.c b/tools/h5ls/dynlib_ls.c index 0d8be2b..d80777d 100644 --- a/tools/h5ls/dynlib_ls.c +++ b/tools/h5ls/dynlib_ls.c @@ -12,59 +12,52 @@ * to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu - * 13 February 2013 - * - * Purpose: Tests the plugin module (H5PL) + * Purpose: Tests the plugin module (H5PL) */ #include #include #include "H5PLextern.h" -#define H5Z_FILTER_DYNLIB2 258 +#define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 -static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, +static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB2[1] = {{ +const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB2, /* Filter id number */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ - "dynlib2", /* Filter name for debugging */ + "dynlibud", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */ + (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;} /*------------------------------------------------------------------------- - * Function: H5Z_filter_dynlib2 + * Function: H5Z_filter_dynlibud * - * Purpose: A dynlib2 filter method that multiplies the original value + * Purpose: A dynlib2 filter method that multiplies the original value * during write and divide the original value during read. It - * will be built as a shared library. plugin.c test will load - * and use this filter library. - * - * Return: Success: Data chunk size - * - * Failure: 0 + * will be built as a shared library. plugin.c test will load + * and use this filter library. * - * Programmer: Raymond Lu - * 29 March 2013 + * Return: Success: Data chunk size * + * Failure: 0 *------------------------------------------------------------------------- */ static size_t -H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, +H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf) { - int *int_ptr = (int *)*buf; /* Pointer to the data values */ + char *int_ptr = (char *)*buf; /* Pointer to the data values */ size_t buf_left = *buf_size; /* Amount of data buffer left to process */ /* Check for the correct number of parameters */ @@ -75,20 +68,24 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, cd_values = cd_values; if(flags & H5Z_FLAG_REVERSE) { /*read*/ - /* Divide the original value with MULTIPLIER */ + /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { - *int_ptr++ /= MULTIPLIER; - buf_left -= sizeof(int); + char temp = *int_ptr; + *int_ptr = temp - MULTIPLIER; + int_ptr++; + buf_left -= sizeof(*int_ptr); } /* end while */ } /* end if */ else { /*write*/ - /* Multiply the original value with MULTIPLIER */ + /* Add the original value with MULTIPLIER */ while(buf_left > 0) { - *int_ptr++ *= MULTIPLIER; - buf_left -= sizeof(int); + char temp = *int_ptr; + *int_ptr = temp + MULTIPLIER; + int_ptr++; + buf_left -= sizeof(*int_ptr); } /* end while */ } /* end else */ return nbytes; -} /* end H5Z_filter_dynlib2() */ +} /* end H5Z_filter_dynlibud() */ diff --git a/tools/h5ls/h5ls_plugin.sh.in b/tools/h5ls/h5ls_plugin.sh.in index 460ff6a..52428bb 100644 --- a/tools/h5ls/h5ls_plugin.sh.in +++ b/tools/h5ls/h5ls_plugin.sh.in @@ -218,7 +218,7 @@ TOOLTEST() { COPY_TESTFILES_TO_TESTDIR # Run the test -TOOLTEST tudfilter.ls 0 -w80 -v -d tudfilter.h5 +TOOLTEST tudfilter.ls 0 -w80 -d tudfilter.h5 # print results if test $nerrors -ne 0 ; then diff --git a/tools/testfiles/tudfilter.h5 b/tools/testfiles/tudfilter.h5 index a1f6d80..a61a954 100644 Binary files a/tools/testfiles/tudfilter.h5 and b/tools/testfiles/tudfilter.h5 differ diff --git a/tools/testfiles/tudfilter.ls b/tools/testfiles/tudfilter.ls index 7ca8682..e9be094 100644 --- a/tools/testfiles/tudfilter.ls +++ b/tools/testfiles/tudfilter.ls @@ -1,23 +1,7 @@ -Opened "tudfilter.h5" with sec2 driver. -dynlib2 Dataset {20/20, 10/10} - Location: 1:800 - Links: 1 - Chunks: {10, 5} 200 bytes - Storage: 800 logical bytes, 800 allocated bytes, 100.00% utilization - Filter-0: dynlib2-258 {} - Type: native int +dynlib2 Dataset {20, 10} Data: - (0,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - (1,9) 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - (3,5) 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - (5,1) 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - (6,7) 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - (8,3) 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - (9,9) 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - (11,2) 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - (12,5) 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - (13,8) 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - (15,1) 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - (16,4) 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - (17,7) 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - (19,0) 190, 191, 192, 193, 194, 195, 196, 197, 198, 199 + (0,0) Unable to print data. +H5tools-DIAG: Error detected in HDF5:tools (1.8.19) thread 0: + #000: /home/byrn/HDF_Projects/hdf5_18/dev/tools/lib/h5tools_dump.c line 1621 in h5tools_dump_simple_dset(): H5Dread failed + major: Failure in tools library + minor: error in function -- cgit v0.12