From c3463d800d7eaf56b5da79d94af9b153f58a512d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 20 Jan 2017 14:23:41 -0600 Subject: HDFFV-10118 fixed plugin tests for tools --- java/src/hdf/hdf5lib/H5.java | 6 +-- tools/test/h5diff/dynlib_diff.c | 57 ++++++++++++-------------- tools/test/h5diff/testfiles/h5diff_ud.txt | 4 +- tools/test/h5diff/testfiles/h5diff_udfail.txt | 6 +-- tools/test/h5diff/testfiles/tudfilter.h5 | Bin 4816 -> 4816 bytes tools/test/h5diff/testfiles/tudfilter2.h5 | Bin 4816 -> 4816 bytes tools/test/h5dump/dynlib_dump.c | 57 ++++++++++++-------------- tools/test/h5dump/h5dumpgentest.c | 54 +++++++++++++++--------- tools/test/h5ls/dynlib_ls.c | 57 ++++++++++++-------------- tools/testfiles/tudfilter.ddl | 2 +- tools/testfiles/tudfilter.h5 | Bin 4816 -> 4816 bytes tools/testfiles/tudfilter.ls | 4 +- 12 files changed, 126 insertions(+), 121 deletions(-) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 6b2af4b..02d35ba 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -151,7 +151,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * layout of the source and destination, and the data for the array passed as a block of bytes, for instance, * *
- *      herr_t H5Dread(int fid, int filetype, int memtype, int memspace,
+ *      herr_t H5Dread(long fid, long filetype, long memtype, long memspace,
  *      void * data);
  * 
* @@ -171,7 +171,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * library. So the function above would be declared: * *
- * public synchronized static native int H5Dread(int fid, int filetype, int memtype, int memspace, Object data);
+ * public synchronized static native int H5Dread(long fid, long filetype, long memtype, long memspace, Object data);
  * 
* OPEN_IDS.addElement(id); @@ -192,7 +192,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * can be accessed as public variables of the Java class, such as: * *
- * int data_type = HDF5CDataTypes.JH5T_NATIVE_INT;
+ * long data_type = HDF5CDataTypes.JH5T_NATIVE_INT;
  * 
* * The Java application uses both types of constants the same way, the only difference is that the diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 0d8be2b..d80777d 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/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/test/h5diff/testfiles/h5diff_ud.txt b/tools/test/h5diff/testfiles/h5diff_ud.txt index 7c9bb5e..ddda3ff 100644 --- a/tools/test/h5diff/testfiles/h5diff_ud.txt +++ b/tools/test/h5diff/testfiles/h5diff_ud.txt @@ -2,10 +2,10 @@ file1 file2 --------------------------------------- x x / - x x /dynlib2 + x x /dynlibud group : and 0 differences found -dataset: and +dataset: and 0 differences found EXIT CODE: 0 diff --git a/tools/test/h5diff/testfiles/h5diff_udfail.txt b/tools/test/h5diff/testfiles/h5diff_udfail.txt index 7eb1155..c154c6b 100644 --- a/tools/test/h5diff/testfiles/h5diff_udfail.txt +++ b/tools/test/h5diff/testfiles/h5diff_udfail.txt @@ -2,11 +2,11 @@ file1 file2 --------------------------------------- x x / - x x /dynlib2 + x x /dynlibud group : and 0 differences found -dataset: and +dataset: and 0 differences found -warning: dataset cannot be read, user defined filter is not available +warning: dataset cannot be read, user defined filter is not available EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/tudfilter.h5 b/tools/test/h5diff/testfiles/tudfilter.h5 index eaf6a43..081b000 100644 Binary files a/tools/test/h5diff/testfiles/tudfilter.h5 and b/tools/test/h5diff/testfiles/tudfilter.h5 differ diff --git a/tools/test/h5diff/testfiles/tudfilter2.h5 b/tools/test/h5diff/testfiles/tudfilter2.h5 index eaf6a43..081b000 100644 Binary files a/tools/test/h5diff/testfiles/tudfilter2.h5 and b/tools/test/h5diff/testfiles/tudfilter2.h5 differ diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index 0d8be2b..d80777d 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/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/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 7df9cbb..0cb9841 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -154,21 +154,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 */ }}; @@ -10314,6 +10314,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 */ @@ -10344,13 +10345,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 */ @@ -10372,9 +10382,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. @@ -10385,11 +10395,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 */ @@ -10400,22 +10410,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/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index 0d8be2b..d80777d 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/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/testfiles/tudfilter.ddl b/tools/testfiles/tudfilter.ddl index 5bdceec..b2aa7e6 100644 --- a/tools/testfiles/tudfilter.ddl +++ b/tools/testfiles/tudfilter.ddl @@ -1,6 +1,6 @@ HDF5 "tudfilter.h5" { GROUP "/" { - DATASET "dynlib2" { + DATASET "dynlibud" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } DATA { diff --git a/tools/testfiles/tudfilter.h5 b/tools/testfiles/tudfilter.h5 index eaf6a43..081b000 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..1156f74 100644 --- a/tools/testfiles/tudfilter.ls +++ b/tools/testfiles/tudfilter.ls @@ -1,10 +1,10 @@ Opened "tudfilter.h5" with sec2 driver. -dynlib2 Dataset {20/20, 10/10} +dynlibud 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 {} + Filter-0: dynlibud-300 {} Type: native int Data: (0,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, -- cgit v0.12