Merge pull request #662 in HDFFV/hdf5 from ~BYRN/hdf5_adb:hdf5_1_10 to hdf5_1_10

* commit '10676247a825627feea046d025170b4c6849cc83':
  HDFFV-10276 Remove whitespace
  HDFFV-10276 Add UD flag option to h5repack
This commit is contained in:
Allen Byrne 2017-09-08 10:00:43 -05:00
commit 8f07727c69
9 changed files with 52 additions and 31 deletions

View File

@ -659,7 +659,7 @@ adding an option (${CTEST_SCRIPT_ARG}) to the platform configuration script.
#############################################################################################
### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ###
### BUILD_GENERATOR required [Unix, VS2017, VS201764, VS2015, VS201564, VS2013, VS201364] ###
### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -VV -O hdf5.log ###
### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ###
#############################################################################################
cmake_minimum_required (VERSION 3.2.2 FATAL_ERROR)

View File

@ -277,6 +277,15 @@ Bug Fixes since HDF5-1.10.0-patch1 release
Tools
-----
- h5repack
h5repack always set the User Defined filter flag to H5Z_FLAG_MANDATORY.
Added another parameter to the 'UD=' option to set the flag by default
to '0' or H5Z_FLAG_MANDATORY, the other choice is '1' or H5Z_FLAG_OPTIONAL.
(ADB - 2017/08/31, HDFFV-10276)
- h5ls
h5ls generated error on stack when it encountered a H5S_NULL

View File

@ -61,6 +61,7 @@ typedef struct {
typedef struct {
H5Z_filter_t filtn; /* filter identification number */
unsigned filt_flag; /* filter definition flag */
unsigned cd_values[CD_VALUES]; /* filter client data values */
size_t cd_nelmts; /* filter client number of values */
} filter_info_t;

View File

@ -402,7 +402,7 @@ int apply_filters(const char* name, /* object name from traverse list */
default:
{
if (H5Pset_filter(dcpl_id, obj.filter[i].filtn,
H5Z_FLAG_MANDATORY, obj.filter[i].cd_nelmts,
obj.filter[i].filt_flag, obj.filter[i].cd_nelmts,
obj.filter[i].cd_values) < 0)
return -1;
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)

View File

@ -164,8 +164,8 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " NBIT (no parameter)\n");
PRINTVALSTREAM(rawoutstream, " SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
PRINTVALSTREAM(rawoutstream, " is either IN or DS\n");
PRINTVALSTREAM(rawoutstream, " UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>\n");
PRINTVALSTREAM(rawoutstream, " required values for filter_number,cd_value_count,value_1\n");
PRINTVALSTREAM(rawoutstream, " UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]>\n");
PRINTVALSTREAM(rawoutstream, " required values for filter_number,filter_flag,cd_value_count,value_1\n");
PRINTVALSTREAM(rawoutstream, " optional values for value_2 to value_N\n");
PRINTVALSTREAM(rawoutstream, " NONE (no parameter)\n");
PRINTVALSTREAM(rawoutstream, "\n");
@ -209,7 +209,7 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Add both filters SHUF and GZIP in this order to all datasets\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "6) h5repack -f UD=307,1,9 file1 file2 \n");
PRINTVALSTREAM(rawoutstream, "6) h5repack -f UD=307,0,1,9 file1 file2\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Add bzip2 filter to all datasets\n");
PRINTVALSTREAM(rawoutstream, "\n");

View File

@ -42,7 +42,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
size_t i, m, u;
char c;
size_t len = HDstrlen(str);
int k, l, p, q, end_obj = -1, no_param = 0;
int f, k, l, p, q, end_obj = -1, no_param = 0;
unsigned j, n;
char sobj[MAX_NC_NAME];
char scomp[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
@ -209,13 +209,14 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
/*-------------------------------------------------------------------------
* User Defined
* has the format UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>
* has the format UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]>
* BZIP2 example
* UD=307,1,9
* UD=307,0,1,9
*-------------------------------------------------------------------------
*/
else if (HDstrcmp(scomp, "UD") == 0) {
l = -1; /* filter number index check */
f = -1; /* filter flag index check */
p = -1; /* CD_VAL count check */
for (m = 0, q = 0, u = i + 1; u < len; u++, m++, q++) {
if (str[u] == ',') {
@ -224,6 +225,10 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
filt->filtn = HDatoi(stype);
l = 0;
}
else if (f == -1) {
filt->filt_flag = HDstrtoul(stype, NULL, 0);
f = 0;
}
else if (p == -1) {
filt->cd_nelmts = HDstrtoull(stype, NULL, 0);
p = 0;
@ -240,6 +245,12 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
error_msg("filter number parameter is not a digit in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
else if (!HDisdigit(c) && f == -1) {
if (obj_list)
HDfree(obj_list);
error_msg("filter flag parameter is not a digit in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
stype[q] = c;
} /* for u */
stype[q] = '\0';

View File

@ -1256,15 +1256,15 @@
##############################################################################
### P L U G I N T E S T S
##############################################################################
ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE})
ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,1,9)
ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,0,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE})
ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,0,1,9)
ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE)
# check for no parameters
set (TESTRETVAL 255)
if (WIN32)
set (TESTRETVAL -1)
endif ()
ADD_H5_CMP_TEST (plugin_zero "" "TEST" ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0)
ADD_H5_CMP_TEST (plugin_zero "" "TEST" ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0,0)
if (HDF5_TEST_VFD)
# Run test with different Virtual File Driver

View File

@ -247,10 +247,10 @@ COPY_TESTFILES_TO_TESTDIR
version_str=`echo @H5_VERSION@ | awk -F"-" '{print $1}' | sed 's/\./,/g'`
# Run the test
arg="h5repack_layout.h5 -v -f UD=260,4,9,$version_str"
arg="h5repack_layout.h5 -v -f UD=260,0,4,9,$version_str"
TOOLTEST_DUMP plugin_version_test $arg
arg="h5repack_layout.h5 -v -f UD=257,1,9"
arg="h5repack_layout.h5 -v -f UD=257,0,1,9"
TOOLTEST_DUMP plugin_test $arg
#arg="h5repack_layout.UD.h5 -v -f NONE"

View File

@ -89,8 +89,8 @@ usage: h5repack [OPTIONS] file1 file2
NBIT (no parameter)
SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type
is either IN or DS
UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>
required values for filter_number,cd_value_count,value_1
UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]>
required values for filter_number,filter_flag,cd_value_count,value_1
optional values for value_2 to value_N
NONE (no parameter)
@ -134,7 +134,7 @@ Examples of use:
Add both filters SHUF and GZIP in this order to all datasets
6) h5repack -f UD=307,1,9 file1 file2
6) h5repack -f UD=307,0,1,9 file1 file2
Add bzip2 filter to all datasets