summaryrefslogtreecommitdiffstats
path: root/hl/test/CMakeTests.cmake
blob: 4e945bce88795f943fd10c360484788cc09208f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#
# Copyright by The HDF Group.
# All rights reserved.
#
# This file is part of HDF5.  The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#

##############################################################################
##############################################################################
###           T E S T I N G                                                ###
##############################################################################
##############################################################################

set (HL_REFERENCE_TEST_FILES
    dtype_file.txt
    image8.txt
    sepia.pal
    earth.pal
    image24pixel.txt
    image24plane.txt
    usa.wri
    test_table_be.h5
    test_table_cray.h5
    test_table_le.h5
    dsdata.txt
    dslat.txt
    dslon.txt
    test_ds_be.h5
    test_ds_le.h5
    test_ld.h5
)

# --------------------------------------------------------------------
#-- Copy the necessary files.
# --------------------------------------------------------------------
foreach (h5_file ${HL_REFERENCE_TEST_FILES})
  HDFTEST_COPY_FILE("${HDF5_HL_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}" "hl_test_files")
endforeach ()
add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tests" DEPENDS ${hl_test_files_list})

# --------------------------------------------------------------------
#  Macro used to add a unit test
# --------------------------------------------------------------------
macro (HL_ADD_TEST hl_name)
  if (HDF5_ENABLE_USING_MEMCHECKER)
    add_test (NAME HL_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>)
  else ()
    add_test (NAME HL_${hl_name} COMMAND "${CMAKE_COMMAND}"
        -D "TEST_PROGRAM=$<TARGET_FILE:hl_${hl_name}>"
        -D "TEST_ARGS:STRING="
        -D "TEST_EXPECT=0"
        -D "TEST_SKIP_COMPARE=TRUE"
        -D "TEST_OUTPUT=hl_${hl_name}.txt"
        #-D "TEST_REFERENCE=hl_${hl_name}.out"
        -D "TEST_FOLDER=${HDF5_HL_TEST_BINARY_DIR}"
        -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
    )
  endif ()
  if (NOT "${last_test}" STREQUAL "")
    set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test}
      ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}"
      WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR}
    )
  endif ()
endmacro ()

# Remove any output file left over from previous test run
add_test (
    NAME HL_test-clear-objects
    COMMAND    ${CMAKE_COMMAND}
        -E remove
        combine_tables1.h5
        combine_tables2.h5
        file_img1.h5
        file_img2.h5
        test_append.h5
        h5do_compat.h5
        test_detach.h5
        test_ds1.h5
        test_ds2.h5
        test_ds3.h5
        test_ds4.h5
        test_ds5.h5
        test_ds6.h5
        test_ds7.h5
        test_ds8.h5
        test_ds9.h5
        test_ds10.h5
        test_image1.h5
        test_image2.h5
        test_image3.h5
        test_lite1.h5
        test_lite2.h5
        test_lite3.h5
        test_lite4.h5
        test_packet_compress.h5
        test_packet_table.h5
        test_packet_table_vlen.h5
        testfl_packet_table_vlen.h5
        test_table.h5
)
if (NOT "${last_test}" STREQUAL "")
  set_tests_properties (HL_test-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "HL_test-clear-objects")

HL_add_test (test_lite )
HL_add_test (test_image)
HL_add_test (test_file_image)
HL_add_test (test_table)
HL_add_test (test_ds)
HL_add_test (test_packet)
HL_add_test (test_ld)
HL_add_test (test_dset_append)
HL_add_test (test_h5do_compat)

ber, &flags, &cd_nelmts,
+ filter_id = H5Pget_filter2(id, filter_number, &flags, &cd_nelmts,
cd_values, namelen, name, &filter_config);
if( filter_id == H5Z_FILTER_ERROR )
- {
throw PropListIException("DSetCreatPropList::getFilter",
- "H5Pget_filter returned H5Z_FILTER_ERROR");
- }
+ "H5Pget_filter2 returned H5Z_FILTER_ERROR");
else
return(filter_id);
}
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index 3f8bebf..02864fe 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -1520,7 +1520,7 @@ nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters)
/*----------------------------------------------------------------------------
* Name: h5pget_filter_c
- * Purpose: Call H5Pget_filter to get information about a filter
+ * Purpose: Call H5Pget_filter2 to get information about a filter
* in a pipeline
* Inputs: prp_id - property list identifier
* filter_number - Sequence number within the filter
@@ -1541,51 +1541,43 @@ nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters)
int_f
nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id)
{
- int ret_value = -1;
- hid_t c_prp_id;
- unsigned c_filter_number;
- unsigned int c_flags;
- size_t c_cd_nelmts, c_namelen;
- size_t c_cd_nelmts_in;
- H5Z_filter_t c_filter;
- unsigned int * c_cd_values;
- char* c_name;
- unsigned i;
-
- c_cd_nelmts_in = (size_t)*cd_nelmts;
- c_namelen = (size_t)*namelen;
- c_name = (char*)malloc(sizeof(char)*c_namelen);
- if (!c_name) return ret_value;
-
- c_cd_values = (unsigned int*)malloc(sizeof(unsigned int)*((int)c_cd_nelmts_in));
- if (!c_cd_values) {HDfree(c_name);
- return ret_value;
- }
+ unsigned int c_flags;
+ size_t c_cd_nelmts;
+ size_t c_cd_nelmts_in = (size_t)*cd_nelmts;
+ H5Z_filter_t c_filter;
+ unsigned int *c_cd_values = NULL;
+ char *c_name = NULL;
+ unsigned i;
+ int ret_value = -1;
+ if(NULL == (c_name = (char *)malloc((size_t)*namelen)))
+ goto DONE;
- /*
- * Call H5Pget_filter function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_filter_number = (unsigned)*filter_number;
- c_filter = H5Pget_filter(c_prp_id, c_filter_number, &c_flags, &c_cd_nelmts, c_cd_values, c_namelen, c_name, NULL);
+ if(NULL == (c_cd_values = (unsigned int *)malloc(sizeof(unsigned int) * c_cd_nelmts_in)))
+ goto DONE;
- if (c_filter < 0) goto DONE;
+ /*
+ * Call H5Pget_filter2 function.
+ */
+ if((c_filter = H5Pget_filter2((hid_t)*prp_id, (unsigned)*filter_number, &c_flags, &c_cd_nelmts, c_cd_values, (size_t)*namelen, c_name, NULL)) < 0)
+ goto DONE;
- *filter_id = (int_f)c_filter;
- *cd_nelmts = (size_t_f)c_cd_nelmts;
- *flags = (int_f)c_flags;
- HD5packFstring(c_name, _fcdtocp(name), strlen(c_name));
+ *filter_id = (int_f)c_filter;
+ *cd_nelmts = (size_t_f)c_cd_nelmts;
+ *flags = (int_f)c_flags;
+ HD5packFstring(c_name, _fcdtocp(name), strlen(c_name));
- for (i = 0; i < c_cd_nelmts_in; i++)
- cd_values[i] = (int_f)c_cd_values[i];
+ for(i = 0; i < c_cd_nelmts_in; i++)
+ cd_values[i] = (int_f)c_cd_values[i];
- ret_value = 0;
+ ret_value = 0;
DONE:
- HDfree(c_name);
- HDfree(c_cd_values);
- return ret_value;
+ if(c_name)
+ HDfree(c_name);
+ if(c_cd_values)
+ HDfree(c_cd_values);
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -3328,7 +3320,7 @@ nh5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f
/*
- * Call H5Pget_filter function.
+ * Call H5Pget_filter_by_id function.
*/
c_prp_id = (hid_t)*prp_id;
c_filter_id = (H5Z_filter_t)*filter_id;
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index e9ed6c5..9ef25b0 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1340,7 +1340,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
/*-------------------------------------------------------------------------
- * Function: H5Pget_filter
+ * Function: H5Pget_filter2
*
* Purpose: This is the query counterpart of H5Pset_filter() and returns
* information about a particular filter number in a permanent
@@ -1363,41 +1363,23 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
*
*-------------------------------------------------------------------------
*/
-#ifdef H5_WANT_H5_V1_6_COMPAT
H5Z_filter_t
-H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
- size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/)
-#else /* H5_WANT_H5_V1_6_COMPAT */
-H5Z_filter_t
-H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
+H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
size_t namelen, char name[]/*out*/,
- unsigned *_filter_config /*out*/)
-#endif /* H5_WANT_H5_V1_6_COMPAT */
+ unsigned *filter_config /*out*/)
{
H5O_pline_t pline; /* Filter pipeline */
const H5Z_filter_info_t *filter; /* Pointer to filter information */
H5P_genplist_t *plist; /* Property list pointer */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- unsigned *filter_config = NULL; /* Filter configuration */
-#else /* H5_WANT_H5_V1_6_COMPAT */
- unsigned *filter_config = _filter_config; /* Filter configuration */
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5Z_filter_t ret_value; /* return value */
- FUNC_ENTER_API(H5Pget_filter, H5Z_FILTER_ERROR)
-#ifdef H5_WANT_H5_V1_6_COMPAT
- H5TRACE7("Zf","iIux*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
- name);
-#else /* H5_WANT_H5_V1_6_COMPAT */
+ FUNC_ENTER_API(H5Pget_filter2, H5Z_FILTER_ERROR)
H5TRACE8("Zf","iIux*zxzx*Iu",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
- name,_filter_config);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
+ name,filter_config);
/* Check args */
- if(cd_nelmts || cd_values)
-{
+ if(cd_nelmts || cd_values) {
/*
* It's likely that users forget to initialize this on input, so
* we'll check that it has a reasonable value. The actual number
@@ -1441,7 +1423,7 @@ H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_filter() */
+} /* end H5Pget_filter2() */
/*-------------------------------------------------------------------------
@@ -2484,3 +2466,90 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fill_time() */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_filter1
+ *
+ * Purpose: This is the query counterpart of H5Pset_filter() and returns
+ * information about a particular filter number in a permanent
+ * or transient pipeline depending on whether PLIST_ID is a
+ * dataset creation or transfer property list. On input,
+ * CD_NELMTS indicates the number of entries in the CD_VALUES
+ * array allocated by the caller while on exit it contains the
+ * number of values defined by the filter. The IDX
+ * should be a value between zero and N-1 as described for
+ * H5Pget_nfilters() and the function will return failure if the
+ * filter number is out of range.
+ *
+ * Return: Success: Filter identification number.
+ *
+ * Failure: H5Z_FILTER_ERROR (Negative)
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+H5Z_filter_t
+H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
+ size_t namelen, char name[]/*out*/)
+{
+ H5O_pline_t pline; /* Filter pipeline */
+ const H5Z_filter_info_t *filter; /* Pointer to filter information */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5Z_filter_t ret_value; /* return value */
+
+ FUNC_ENTER_API(H5Pget_filter1, H5Z_FILTER_ERROR)
+ H5TRACE7("Zf","iIux*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
+ name);
+
+ /* Check args */
+ if(cd_nelmts || cd_values) {
+ /*
+ * It's likely that users forget to initialize this on input, so
+ * we'll check that it has a reasonable value. The actual number
+ * is unimportant because the H5O layer will detect when a message
+ * is too large.
+ */
+ if(cd_nelmts && *cd_nelmts > 256)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "probable uninitialized *cd_nelmts argument")
+ if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied")
+
+ /*
+ * If cd_nelmts is null but cd_values is non-null then just ignore
+ * cd_values
+ */
+ if(!cd_nelmts)
+ cd_values = NULL;
+ } /* end if */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID")
+
+ /* Get pipeline info */
+ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline")
+
+ /* Check more args */
+ if(idx >= pline.nused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid")
+
+ /* Set pointer to particular filter to query */
+ filter = &pline.filter[idx];
+
+ /* Get filter information */
+ if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
+
+ /* Set return value */
+ ret_value = filter->id;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_filter1() */
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h