summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-06-12 19:14:25 (GMT)
committerGitHub <noreply@github.com>2023-06-12 19:14:25 (GMT)
commita1a9526b1438b5275e15e46b2bd890e94b88231f (patch)
treebb6c5b1792828299228e4a606c098c4721ed0b3a
parent37990e63c4751493f9c2af8c46e0c230a49e286f (diff)
downloadhdf5-a1a9526b1438b5275e15e46b2bd890e94b88231f.zip
hdf5-a1a9526b1438b5275e15e46b2bd890e94b88231f.tar.gz
hdf5-a1a9526b1438b5275e15e46b2bd890e94b88231f.tar.bz2
Address memory issues when copying empty enums (#3088)
When copying an empty enum type (including implicitly, as when an enum is contained in a compound type), the library would allocate 0-size blocks of memory and attempt to memcpy 0 bytes from NULL pointers, which are undefined behavior. In debug mode, the library would raise an assert in H5MM. The library now avoid undefined memory operations when copying empty enum types and a test that copies empty enums has been added.
-rw-r--r--release_docs/RELEASE.txt11
-rw-r--r--src/H5T.c37
-rw-r--r--src/H5Tcompound.c6
-rw-r--r--test/enum.c984
4 files changed, 545 insertions, 493 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 7153c4e..559d474 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -228,6 +228,17 @@ Bug Fixes since HDF5-1.14.0 release
===================================
Library
-------
+ - Fixed a potential bug when copying empty enum datatypes
+
+ Copying an empty enum datatype (including implicitly, as when an enum
+ is a part of a compound datatype) would fail in an assert in debug
+ mode and could fail in release mode depending on how the platform
+ handles undefined behavior regarding size 0 memory allocations and
+ using memcpy with a NULL src pointer.
+
+ The library is now more more careful about using memory operations when
+ copying empty enum datatypes and will not error or raise an assert.
+
- Added an AAPL check to H5Acreate
A check was added to H5Acreate to ensure that a failure is correctly
diff --git a/src/H5T.c b/src/H5T.c
index e2debd4..27c7a60 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -3623,21 +3623,28 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo
* of each new member with copied values. That is, H5T_copy() is a
* deep copy.
*/
- if (NULL == (new_dt->shared->u.enumer.name =
- H5MM_malloc(new_dt->shared->u.enumer.nalloc * sizeof(char *))))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "enam name array memory allocation failed")
- if (NULL == (new_dt->shared->u.enumer.value =
- H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL,
- "enam value array memory allocation failed")
- H5MM_memcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value,
- new_dt->shared->u.enumer.nmembs * new_dt->shared->size);
- for (i = 0; i < new_dt->shared->u.enumer.nmembs; i++) {
- if (NULL == (s = H5MM_xstrdup(old_dt->shared->u.enumer.name[i])))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL,
- "can't copy string for enum value's name")
- new_dt->shared->u.enumer.name[i] = s;
- } /* end for */
+ if (old_dt->shared->u.enumer.nalloc > 0) {
+ if (NULL == (new_dt->shared->u.enumer.name =
+ H5MM_malloc(new_dt->shared->u.enumer.nalloc * sizeof(char *))))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL,
+ "enam name array memory allocation failed")
+ if (NULL == (new_dt->shared->u.enumer.value =
+ H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL,
+ "enam value array memory allocation failed")
+ H5MM_memcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value,
+ new_dt->shared->u.enumer.nmembs * new_dt->shared->size);
+ for (i = 0; i < new_dt->shared->u.enumer.nmembs; i++) {
+ if (NULL == (s = H5MM_xstrdup(old_dt->shared->u.enumer.name[i])))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL,
+ "can't copy string for enum value's name")
+ new_dt->shared->u.enumer.name[i] = s;
+ }
+ }
+ else {
+ /* Empty enum */
+ HDmemset(&new_dt->shared->u.enumer, 0, sizeof(H5T_enum_t));
+ }
break;
case H5T_VLEN:
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index 8ba3d69..201d3ae 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -469,10 +469,12 @@ H5T__insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
/* Add member to end of member array */
idx = parent->shared->u.compnd.nmembs;
- parent->shared->u.compnd.memb[idx].name = H5MM_xstrdup(name);
parent->shared->u.compnd.memb[idx].offset = offset;
parent->shared->u.compnd.memb[idx].size = total_size;
- parent->shared->u.compnd.memb[idx].type = H5T_copy(member, H5T_COPY_ALL);
+ if (NULL == (parent->shared->u.compnd.memb[idx].name = H5MM_xstrdup(name)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "couldn't duplicate name string")
+ if (NULL == (parent->shared->u.compnd.memb[idx].type = H5T_copy(member, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "couldn't copy datatype")
parent->shared->u.compnd.sorted = H5T_SORT_NONE;
parent->shared->u.compnd.nmembs++;
diff --git a/test/enum.c b/test/enum.c
index 592236a..90cbe68 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -11,10 +11,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke
- * Tuesday, December 22, 1998
+ * Test enum datatypes
*/
+
#include "h5test.h"
+
+/* Convenience macro for inserting enum values */
#define CPTR(VAR, CONST) ((VAR) = (CONST), &(VAR))
const char *FILENAME[] = {"enum1", NULL};
@@ -22,92 +24,88 @@ const char *FILENAME[] = {"enum1", NULL};
typedef enum { E1_RED, E1_GREEN, E1_BLUE, E1_WHITE, E1_BLACK } c_e1;
/*-------------------------------------------------------------------------
- * Function: test_named
- *
- * Purpose: Create an enumeration data type and store it in the file.
+ * Function: test_named
*
- * Return: Success: 0
- *
- * Failure: number of errors
- *
- * Programmer: Robb Matzke
- * Wednesday, December 23, 1998
+ * Purpose: Create an enumeration data type and store it in the file
*
+ * Return: Success: 0
+ * Failure: 1
*-------------------------------------------------------------------------
*/
static int
test_named(hid_t file)
{
- hid_t type = -1, cwg = -1;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
c_e1 val;
signed char val8;
TESTING("named enumeration types");
- if ((cwg = H5Gcreate2(file, "test_named", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ if ((gid = H5Gcreate2(file, "test_named", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* A native integer */
- if ((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "RED", CPTR(val, E1_RED)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "BLUE", CPTR(val, E1_BLUE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tcommit2(cwg, "e1_a", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR;
- if (H5Tclose(type) < 0)
- FAIL_STACK_ERROR;
+ if ((tid = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "RED", CPTR(val, E1_RED)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "GREEN", CPTR(val, E1_GREEN)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "BLUE", CPTR(val, E1_BLUE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "WHITE", CPTR(val, E1_WHITE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "BLACK", CPTR(val, E1_BLACK)) < 0)
+ TEST_ERROR;
+ if (H5Tcommit2(gid, "e1_a", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
/* A smaller type */
- if ((type = H5Tcreate(H5T_ENUM, (size_t)1)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "RED", CPTR(val8, E1_RED)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "GREEN", CPTR(val8, E1_GREEN)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "BLUE", CPTR(val8, E1_BLUE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "WHITE", CPTR(val8, E1_WHITE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "BLACK", CPTR(val8, E1_BLACK)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tcommit2(cwg, "e1_b", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR;
- if (H5Tclose(type) < 0)
- FAIL_STACK_ERROR;
+ if ((tid = H5Tcreate(H5T_ENUM, (size_t)1)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "RED", CPTR(val8, E1_RED)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "GREEN", CPTR(val8, E1_GREEN)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "BLUE", CPTR(val8, E1_BLUE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "WHITE", CPTR(val8, E1_WHITE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "BLACK", CPTR(val8, E1_BLACK)) < 0)
+ TEST_ERROR;
+ if (H5Tcommit2(gid, "e1_b", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
/* A non-native type */
if (H5T_ORDER_BE == H5Tget_order(H5T_NATIVE_INT)) {
- if ((type = H5Tenum_create(H5T_STD_U8LE)) < 0)
- FAIL_STACK_ERROR;
+ if ((tid = H5Tenum_create(H5T_STD_U8LE)) < 0)
+ TEST_ERROR;
}
else {
- if ((type = H5Tenum_create(H5T_STD_U8BE)) < 0)
- FAIL_STACK_ERROR;
+ if ((tid = H5Tenum_create(H5T_STD_U8BE)) < 0)
+ TEST_ERROR;
}
- if (H5Tenum_insert(type, "RED", CPTR(val8, E1_RED)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "GREEN", CPTR(val8, E1_GREEN)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "BLUE", CPTR(val8, E1_BLUE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "WHITE", CPTR(val8, E1_WHITE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "BLACK", CPTR(val8, E1_BLACK)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tcommit2(cwg, "e1_c", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR;
- if (H5Tclose(type) < 0)
- FAIL_STACK_ERROR;
-
- if (H5Gclose(cwg) < 0)
- FAIL_STACK_ERROR;
+ if (H5Tenum_insert(tid, "RED", CPTR(val8, E1_RED)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "GREEN", CPTR(val8, E1_GREEN)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "BLUE", CPTR(val8, E1_BLUE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "WHITE", CPTR(val8, E1_WHITE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "BLACK", CPTR(val8, E1_BLACK)) < 0)
+ TEST_ERROR;
+ if (H5Tcommit2(gid, "e1_c", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
+
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
PASSED();
return 0;
@@ -115,173 +113,167 @@ test_named(hid_t file)
error:
H5E_BEGIN_TRY
{
- H5Tclose(type);
- H5Gclose(cwg);
+ H5Tclose(tid);
+ H5Gclose(gid);
}
H5E_END_TRY;
return 1;
}
/*-------------------------------------------------------------------------
- * Function: test_conv
- *
- * Purpose: Tests writing and read data
+ * Function: test_conv
*
- * Return: Success: 0
+ * Purpose: Tests writing and read data
*
- * Failure: number of errors
- *
- * Programmer: Robb Matzke
- * Monday, January 4, 1999
- *
- * Raymond Lu
- * 12 October 2012
- * I added tests for enum-integer and enum-float conversions
+ * Return: Success: 0
+ * Failure: 1
*-------------------------------------------------------------------------
*/
static int
test_conv(hid_t file)
{
- hid_t cwg = -1, type = -1, space = -1, dset = -1;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
c_e1 val;
/* Some values are out of range for testing. The library should accept them */
- static c_e1 data1[] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, E1_WHITE, E1_BLACK,
- E1_GREEN, E1_BLUE, E1_RED, E1_RED, E1_BLUE, E1_GREEN, E1_BLACK,
- E1_WHITE, E1_RED, E1_WHITE, (c_e1)0, (c_e1)-1, (c_e1)-2};
- c_e1 data2[NELMTS(data1)];
- short data_short[NELMTS(data1)];
- int data_int[NELMTS(data1)];
- double data_double[NELMTS(data1)];
- hsize_t ds_size[1] = {NELMTS(data1)};
- size_t i;
+ c_e1 data1[] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, E1_WHITE, E1_BLACK,
+ E1_GREEN, E1_BLUE, E1_RED, E1_RED, E1_BLUE, E1_GREEN, E1_BLACK,
+ E1_WHITE, E1_RED, E1_WHITE, (c_e1)0, (c_e1)-1, (c_e1)-2};
+ c_e1 data2[NELMTS(data1)];
+ short data_short[NELMTS(data1)];
+ int data_int[NELMTS(data1)];
+ double data_double[NELMTS(data1)];
+ hsize_t ds_size = NELMTS(data1);
+ size_t i;
TESTING("enumeration conversions");
- if ((cwg = H5Gcreate2(file, "test_conv", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
-
- if ((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "RED", CPTR(val, E1_RED)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "BLUE", CPTR(val, E1_BLUE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0)
- FAIL_STACK_ERROR;
-
- if ((space = H5Screate_simple(1, ds_size, NULL)) < 0)
- FAIL_STACK_ERROR;
+ if ((gid = H5Gcreate2(file, "test_conv", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ if ((tid = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "RED", CPTR(val, E1_RED)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "GREEN", CPTR(val, E1_GREEN)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "BLUE", CPTR(val, E1_BLUE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "WHITE", CPTR(val, E1_WHITE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "BLACK", CPTR(val, E1_BLACK)) < 0)
+ TEST_ERROR;
+
+ if ((sid = H5Screate_simple(1, &ds_size, NULL)) < 0)
+ TEST_ERROR;
/***************************************
* Dataset of enumeration type
***************************************/
/* Create a dataset of enum type and write enum data to it */
- if ((dset = H5Dcreate2(cwg, "color_table1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
- if (H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0)
- FAIL_STACK_ERROR;
+ if ((did = H5Dcreate2(gid, "color_table1", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Dwrite(did, tid, sid, sid, H5P_DEFAULT, data1) < 0)
+ TEST_ERROR;
/* Test reading back the data with no conversion */
- if (H5Dread(dset, type, space, space, H5P_DEFAULT, data2) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dread(did, tid, sid, sid, H5P_DEFAULT, data2) < 0)
+ TEST_ERROR;
- for (i = 0; i < (size_t)ds_size[0]; i++)
+ for (i = 0; i < ds_size; i++)
if (data1[i] != data2[i]) {
H5_FAILED();
- HDprintf(" 1. data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i,
- (int)(data1[i]), (unsigned long)i, (int)(data2[i]));
+ HDprintf(" 1. data1[%zu]=%d, data2[%zu]=%d (should be same)\n", i, (int)data1[i], i,
+ (int)data2[i]);
goto error;
- } /* end if */
+ }
/* Test converting the data to integer. Read enum data back as integer */
- if (H5Dread(dset, H5T_NATIVE_SHORT, space, space, H5P_DEFAULT, data_short) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dread(did, H5T_NATIVE_SHORT, sid, sid, H5P_DEFAULT, data_short) < 0)
+ TEST_ERROR;
- for (i = 0; i < (size_t)ds_size[0]; i++)
- if ((short)data1[i] != data_short[i]) {
+ for (i = 0; i < ds_size; i++)
+ if ((int)data1[i] != (int)data_short[i]) {
H5_FAILED();
- HDprintf(" 2. data1[%lu]=%d, data_short[%lu]=%d (should be same)\n", (unsigned long)i,
- (int)(data1[i]), (unsigned long)i, (int)(data_short[i]));
+ HDprintf(" 2. data1[%zu]=%d, data_short[%zu]=%d (should be same)\n", i, (int)data1[i], i,
+ (int)data_short[i]);
goto error;
- } /* end if */
+ }
/* Test converting the data to floating number. Read enum data back as floating number */
- if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, data_double) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dread(did, H5T_NATIVE_DOUBLE, sid, sid, H5P_DEFAULT, data_double) < 0)
+ TEST_ERROR;
- for (i = 0; i < (size_t)ds_size[0]; i++)
+ for (i = 0; i < ds_size; i++)
if ((int)data1[i] != (int)data_double[i]) {
H5_FAILED();
- HDprintf(" 3. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", (unsigned long)i,
- (int)(data1[i]), (unsigned long)i, (int)(data_double[i]));
+ HDprintf(" 3. data1[%zu]=%d, data_double[%zu]=%d (should be same)\n", i, (int)data1[i], i,
+ (int)data_double[i]);
goto error;
- } /* end if */
+ }
- if (H5Dclose(dset) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
/***************************************
* Dataset of integer type
***************************************/
/* Create a dataset of native integer and write enum data to it */
- if ((dset = H5Dcreate2(cwg, "color_table2", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ if ((did = H5Dcreate2(gid, "color_table2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR;
- if (H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dwrite(did, tid, sid, sid, H5P_DEFAULT, data1) < 0)
+ TEST_ERROR;
/* Test reading back the data with no conversion */
- if (H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, data_int) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dread(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data_int) < 0)
+ TEST_ERROR;
- for (i = 0; i < (size_t)ds_size[0]; i++)
+ for (i = 0; i < ds_size; i++)
if ((int)data1[i] != data_int[i]) {
H5_FAILED();
- HDprintf(" 4. data1[%lu]=%d, data_int[%lu]=%d (should be same)\n", (unsigned long)i,
- (int)(data1[i]), (unsigned long)i, (int)(data_int[i]));
+ HDprintf(" 4. data1[%zu]=%d, data_int[%zu]=%d (should be same)\n", i, (int)data1[i], i,
+ data_int[i]);
goto error;
- } /* end if */
+ }
- if (H5Dclose(dset) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
/***************************************
* Dataset of double type
***************************************/
/* Create a dataset of native double and write enum data to it */
- if ((dset = H5Dcreate2(cwg, "color_table3", H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ if ((did = H5Dcreate2(gid, "color_table3", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if (H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dwrite(did, tid, sid, sid, H5P_DEFAULT, data1) < 0)
+ TEST_ERROR;
/* Test reading back the data with no conversion */
- if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, data_double) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dread(did, H5T_NATIVE_DOUBLE, sid, sid, H5P_DEFAULT, data_double) < 0)
+ TEST_ERROR;
- for (i = 0; i < (size_t)ds_size[0]; i++)
+ for (i = 0; i < ds_size; i++)
if ((int)data1[i] != (int)data_double[i]) {
H5_FAILED();
- HDprintf(" 5. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", (unsigned long)i,
- (int)(data1[i]), (unsigned long)i, (int)(data_double[i]));
+ HDprintf(" 5. data1[%zu]=%d, data_double[%zu]=%d (should be same)\n", i, (int)data1[i], i,
+ (int)data_double[i]);
goto error;
- } /* end if */
-
- if (H5Dclose(dset) < 0)
- FAIL_STACK_ERROR;
+ }
- if (H5Sclose(space) < 0)
- FAIL_STACK_ERROR;
- if (H5Tclose(type) < 0)
- FAIL_STACK_ERROR;
- if (H5Gclose(cwg) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
PASSED();
return 0;
@@ -289,102 +281,100 @@ test_conv(hid_t file)
error:
H5E_BEGIN_TRY
{
- H5Dclose(dset);
- H5Sclose(space);
- H5Tclose(type);
- H5Gclose(cwg);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Tclose(tid);
+ H5Gclose(gid);
}
H5E_END_TRY;
return 1;
}
/*-------------------------------------------------------------------------
- * Function: test_tr1
- *
- * Purpose: Writes enumerated data to a dataset which requires
- * translation. Both memory and file data types use native
- * integers but the file type has a different mapping between
- * the integers and symbols.
+ * Function: test_tr1
*
- * Return: Success: 0
- *
- * Failure: number of errors
- *
- * Programmer: Robb Matzke
- * Monday, January 4, 1999
+ * Purpose: Writes enumerated data to a dataset which requires
+ * translation. Both memory and file data types use native
+ * integers but the file type has a different mapping between
+ * the integers and symbols.
*
+ * Return: Success: 0
+ * Failure: 1
*-------------------------------------------------------------------------
*/
static int
test_tr1(hid_t file)
{
- hid_t cwg = -1, m_type = -1, f_type = -1, space = -1, dset = -1;
- hsize_t ds_size[1] = {10};
- size_t i;
- c_e1 eval;
- int ival;
- static c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
- E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED};
- c_e1 data2[10];
+ hid_t gid = H5I_INVALID_HID;
+ hid_t m_tid = H5I_INVALID_HID;
+ hid_t f_tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hsize_t ds_size = 10;
+ c_e1 eval;
+ int ival;
+ c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
+ E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED};
+ c_e1 data2[10];
TESTING("O(1) conversions");
- if ((cwg = H5Gcreate2(file, "test_tr1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
-
- if ((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(m_type, "RED", CPTR(eval, E1_RED)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(m_type, "GREEN", CPTR(eval, E1_GREEN)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(m_type, "BLUE", CPTR(eval, E1_BLUE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(m_type, "WHITE", CPTR(eval, E1_WHITE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(m_type, "BLACK", CPTR(eval, E1_BLACK)) < 0)
- FAIL_STACK_ERROR;
-
- if ((f_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(f_type, "RED", CPTR(ival, 105)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(f_type, "GREEN", CPTR(ival, 104)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(f_type, "BLUE", CPTR(ival, 103)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(f_type, "WHITE", CPTR(ival, 102)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(f_type, "BLACK", CPTR(ival, 101)) < 0)
- FAIL_STACK_ERROR;
-
- if ((space = H5Screate_simple(1, ds_size, NULL)) < 0)
- FAIL_STACK_ERROR;
- if ((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
- if (H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0)
- FAIL_STACK_ERROR;
- if (H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0)
- FAIL_STACK_ERROR;
-
- for (i = 0; i < (size_t)ds_size[0]; i++)
+ if ((gid = H5Gcreate2(file, "test_tr1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ if ((m_tid = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(m_tid, "RED", CPTR(eval, E1_RED)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(m_tid, "GREEN", CPTR(eval, E1_GREEN)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(m_tid, "BLUE", CPTR(eval, E1_BLUE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(m_tid, "WHITE", CPTR(eval, E1_WHITE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(m_tid, "BLACK", CPTR(eval, E1_BLACK)) < 0)
+ TEST_ERROR;
+
+ if ((f_tid = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(f_tid, "RED", CPTR(ival, 105)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(f_tid, "GREEN", CPTR(ival, 104)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(f_tid, "BLUE", CPTR(ival, 103)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(f_tid, "WHITE", CPTR(ival, 102)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(f_tid, "BLACK", CPTR(ival, 101)) < 0)
+ TEST_ERROR;
+
+ if ((sid = H5Screate_simple(1, &ds_size, NULL)) < 0)
+ TEST_ERROR;
+ if ((did = H5Dcreate2(gid, "color_table", f_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Dwrite(did, m_tid, sid, sid, H5P_DEFAULT, data1) < 0)
+ TEST_ERROR;
+ if (H5Dread(did, m_tid, sid, sid, H5P_DEFAULT, data2) < 0)
+ TEST_ERROR;
+
+ for (size_t i = 0; i < ds_size; i++)
if (data1[i] != data2[i]) {
H5_FAILED();
- HDprintf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]),
- (unsigned long)i, (int)(data2[i]));
+ HDprintf(" data1[%zu]=%d, data2[%zu]=%d (should be same)\n", i, (int)data1[i], i,
+ (int)data2[i]);
goto error;
}
- if (H5Dclose(dset) < 0)
- FAIL_STACK_ERROR;
- if (H5Sclose(space) < 0)
- FAIL_STACK_ERROR;
- if (H5Tclose(m_type) < 0)
- FAIL_STACK_ERROR;
- if (H5Tclose(f_type) < 0)
- FAIL_STACK_ERROR;
- if (H5Gclose(cwg) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR;
+ if (H5Tclose(m_tid) < 0)
+ TEST_ERROR;
+ if (H5Tclose(f_tid) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
PASSED();
@@ -393,100 +383,99 @@ test_tr1(hid_t file)
error:
H5E_BEGIN_TRY
{
- H5Dclose(dset);
- H5Sclose(space);
- H5Tclose(m_type);
- H5Tclose(f_type);
- H5Gclose(cwg);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Tclose(m_tid);
+ H5Tclose(f_tid);
+ H5Gclose(gid);
}
H5E_END_TRY;
return 1;
}
/*-------------------------------------------------------------------------
- * Function: test_tr2
- *
- * Purpose: Tests conversions that use the O(log N) lookup function.
+ * Function: test_tr2
*
- * Return: Success: 0
- *
- * Failure: number of errors
- *
- * Programmer: Robb Matzke
- * Tuesday, January 5, 1999
+ * Purpose: Tests conversions that use the O(log N) lookup function
*
+ * Return: Success: 0
+ * Failure: 1
*-------------------------------------------------------------------------
*/
static int
test_tr2(hid_t file)
{
- hid_t cwg = -1, m_type = -1, f_type = -1, space = -1, dset = -1;
- hsize_t ds_size[1] = {10};
- size_t i;
- c_e1 val1;
- int val2;
- static c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
- E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED};
- c_e1 data2[10];
+ hid_t gid = H5I_INVALID_HID;
+ hid_t m_tid = H5I_INVALID_HID;
+ hid_t f_tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hsize_t ds_size = 10;
+ size_t i;
+ c_e1 val1;
+ int val2;
+ c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
+ E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED};
+ c_e1 data2[10];
TESTING("O(log N) conversions");
- if ((cwg = H5Gcreate2(file, "test_tr2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
-
- if ((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(m_type, "RED", CPTR(val1, E1_RED)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(m_type, "GREEN", CPTR(val1, E1_GREEN)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(m_type, "BLUE", CPTR(val1, E1_BLUE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(m_type, "WHITE", CPTR(val1, E1_WHITE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(m_type, "BLACK", CPTR(val1, E1_BLACK)) < 0)
- FAIL_STACK_ERROR;
-
- if ((f_type = H5Tcreate(H5T_ENUM, sizeof(int))) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(f_type, "RED", CPTR(val2, 1050)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(f_type, "GREEN", CPTR(val2, 1040)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(f_type, "BLUE", CPTR(val2, 1030)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(f_type, "WHITE", CPTR(val2, 1020)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(f_type, "BLACK", CPTR(val2, 1010)) < 0)
- FAIL_STACK_ERROR;
-
- if ((space = H5Screate_simple(1, ds_size, NULL)) < 0)
- FAIL_STACK_ERROR;
- if ((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
- if (H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0)
- FAIL_STACK_ERROR;
- if (H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0)
- FAIL_STACK_ERROR;
-
- for (i = 0; i < (size_t)ds_size[0]; i++)
+ if ((gid = H5Gcreate2(file, "test_tr2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ if ((m_tid = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(m_tid, "RED", CPTR(val1, E1_RED)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(m_tid, "GREEN", CPTR(val1, E1_GREEN)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(m_tid, "BLUE", CPTR(val1, E1_BLUE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(m_tid, "WHITE", CPTR(val1, E1_WHITE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(m_tid, "BLACK", CPTR(val1, E1_BLACK)) < 0)
+ TEST_ERROR;
+
+ if ((f_tid = H5Tcreate(H5T_ENUM, sizeof(int))) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(f_tid, "RED", CPTR(val2, 1050)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(f_tid, "GREEN", CPTR(val2, 1040)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(f_tid, "BLUE", CPTR(val2, 1030)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(f_tid, "WHITE", CPTR(val2, 1020)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(f_tid, "BLACK", CPTR(val2, 1010)) < 0)
+ TEST_ERROR;
+
+ if ((sid = H5Screate_simple(1, &ds_size, NULL)) < 0)
+ TEST_ERROR;
+ if ((did = H5Dcreate2(gid, "color_table", f_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Dwrite(did, m_tid, sid, sid, H5P_DEFAULT, data1) < 0)
+ TEST_ERROR;
+ if (H5Dread(did, m_tid, sid, sid, H5P_DEFAULT, data2) < 0)
+ TEST_ERROR;
+
+ for (i = 0; i < ds_size; i++)
if (data1[i] != data2[i]) {
H5_FAILED();
- HDprintf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]),
- (unsigned long)i, (int)(data2[i]));
+ HDprintf(" data1[%zu]=%d, data2[%zu]=%d (should be same)\n", i, (int)data1[i], i,
+ (int)data2[i]);
goto error;
}
- if (H5Dclose(dset) < 0)
- FAIL_STACK_ERROR;
- if (H5Sclose(space) < 0)
- FAIL_STACK_ERROR;
- if (H5Tclose(m_type) < 0)
- FAIL_STACK_ERROR;
- if (H5Tclose(f_type) < 0)
- FAIL_STACK_ERROR;
- if (H5Gclose(cwg) < 0)
- FAIL_STACK_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR;
+ if (H5Tclose(m_tid) < 0)
+ TEST_ERROR;
+ if (H5Tclose(f_tid) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
PASSED();
@@ -495,20 +484,20 @@ test_tr2(hid_t file)
error:
H5E_BEGIN_TRY
{
- H5Dclose(dset);
- H5Sclose(space);
- H5Tclose(m_type);
- H5Tclose(f_type);
- H5Gclose(cwg);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Tclose(m_tid);
+ H5Tclose(f_tid);
+ H5Gclose(gid);
}
H5E_END_TRY;
return 1;
}
/*-------------------------------------------------------------------------
- * Function: test_value_dsnt_exist
+ * Function: test_value_dsnt_exist
*
- * Purpose: Create an enumeration datatype with "gaps in values"
+ * Purpose: Create an enumeration datatype with "gaps in values"
* and then request a name of non-existing value within
* an existing range by calling H5Tenum_nameof function.
* Function should fail instead of succeeding and returning
@@ -516,211 +505,201 @@ error:
* Request a value by supplying non-existing name by calling
* H5Tenum_nameof function. Function should fail.
*
- *
- * Return: Success: 0
- *
- * Failure: number of errors
- *
- * Programmer: Elena Pourmal
- * Wednesday, June 7, 2002
- *
+ * Return: Success: 0
+ * Failure: 1
*-------------------------------------------------------------------------
*/
static int
test_value_dsnt_exist(void)
{
- hid_t datatype_id = (-1); /* identifiers */
- int val;
- char name[100];
- size_t size = 100;
- TESTING("for non-existing name and value");
- /* Turn off error reporting since we expect failure in this test */
+ hid_t tid = H5I_INVALID_HID;
+ int val;
+ char name[32];
+ size_t size = 32;
+ const int BAD_VALUES[] = {0, 3, 11};
+ const int N_BAD_VALUES = 3;
+ const char *BAD_NAMES[] = {"SAX", "TEEN", "A"};
+ const int N_BAD_NAMES = 3;
+ herr_t ret;
- if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
- goto error;
+ TESTING("for non-existing name and value");
- if ((datatype_id = H5Tenum_create(H5T_NATIVE_INT)) < 0)
- goto error;
+ /* Create an empty enum datatype */
+ if ((tid = H5Tenum_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR;
/* These calls should fail, since no members exist yet */
- if (H5Tenum_valueof(datatype_id, "SAX", &val) >= 0)
- goto error;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tenum_valueof(tid, "SAX", &val);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ FAIL_PUTS_ERROR("H5Tenum_valueof should not pass with a non-existing name");
+
val = 3;
- if (H5Tenum_nameof(datatype_id, &val, name, size) >= 0)
- goto error;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tenum_nameof(tid, &val, name, size);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ FAIL_PUTS_ERROR("H5Tenum_nameof should not pass with a non-existing value");
+ /* Insert some enum values */
val = 2;
- if (H5Tenum_insert(datatype_id, "TWO", (int *)&val) < 0)
- goto error;
+ if (H5Tenum_insert(tid, "TWO", (int *)&val) < 0)
+ TEST_ERROR;
val = 6;
- if (H5Tenum_insert(datatype_id, "SIX", (int *)&val) < 0)
- goto error;
+ if (H5Tenum_insert(tid, "SIX", (int *)&val) < 0)
+ TEST_ERROR;
val = 10;
- if (H5Tenum_insert(datatype_id, "TEN", (int *)&val) < 0)
- goto error;
-
- /* This call should fail since we did not create a member with value = 3*/
- val = 3;
- if (H5Tenum_nameof(datatype_id, &val, name, size) >= 0)
- goto error;
-
- /* This call should fail since we did not create a member with value = 11*/
- val = 11;
- if (H5Tenum_nameof(datatype_id, &val, name, size) >= 0)
- goto error;
-
- /* This call should fail since we did not create a member with value = 0*/
- val = 0;
- if (H5Tenum_nameof(datatype_id, &val, name, size) >= 0)
- goto error;
-
- /* This call should fail since we do not have SAX name in the type */
- if (H5Tenum_valueof(datatype_id, "SAX", &val) >= 0)
- goto error;
+ if (H5Tenum_insert(tid, "TEN", (int *)&val) < 0)
+ TEST_ERROR;
+
+ /* Check that H5Tenum_nameof() fails with non-existing values */
+ for (int i = 0; i < N_BAD_VALUES; i++) {
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tenum_nameof(tid, &BAD_VALUES[i], name, size);
+ }
+ H5E_END_TRY;
+ if (ret >= 0) {
+ H5_FAILED();
+ HDprintf("Bad value: %d -- ", BAD_VALUES[i]);
+ PUTS_ERROR("H5Tenum_nameof should not pass with a non-existing value");
+ }
+ }
- /* This call should fail since we do not have TEEN name in the type */
- if (H5Tenum_valueof(datatype_id, "TEEN", &val) >= 0)
- goto error;
+ /* Check that H5Tenum_valueof() fails with non-existing names */
+ for (int i = 0; i < N_BAD_NAMES; i++) {
+ H5E_BEGIN_TRY
+ {
+ ret = H5Tenum_valueof(tid, BAD_NAMES[i], &val);
+ }
+ H5E_END_TRY;
+ if (ret >= 0) {
+ H5_FAILED();
+ HDprintf("Bad name: %s -- ", BAD_NAMES[i]);
+ PUTS_ERROR("H5Tenum_valueof should not pass with a non-existing name");
+ }
+ }
- /* This call should fail since we do not have A name in the type */
- if (H5Tenum_valueof(datatype_id, "A", &val) >= 0)
- goto error;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
- if (H5Tclose(datatype_id) < 0)
- goto error;
PASSED();
return 0;
error:
H5E_BEGIN_TRY
{
- H5Tclose(datatype_id);
+ H5Tclose(tid);
}
H5E_END_TRY;
return 1;
}
/*-------------------------------------------------------------------------
- * Function: test_funcs
- *
- * Purpose: Create an enumeration data type and test some functions
- * that are or aren't supposed to work with it.
+ * Function: test_funcs
*
- * Return: Success: 0
- *
- * Failure: number of errors
- *
- * Programmer: Raymond Lu
- * Tuesday, April 4, 2006
+ * Purpose: Create an enumeration data type and test whether setters
+ * and getters work appropriately
*
+ * Return: Success: 0
+ * Failure: 1
*-------------------------------------------------------------------------
*/
static int
test_funcs(void)
{
- hid_t type = -1;
+ hid_t tid = H5I_INVALID_HID;
c_e1 val;
size_t size;
H5T_pad_t inpad;
H5T_cset_t cset;
herr_t ret;
- TESTING("some functions with enumeration types");
-
- /* A native integer */
- if ((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "RED", CPTR(val, E1_RED)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "BLUE", CPTR(val, E1_BLUE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE)) < 0)
- FAIL_STACK_ERROR;
- if (H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0)
- FAIL_STACK_ERROR;
-
- if (H5Tget_precision(type) == 0)
- FAIL_STACK_ERROR;
- if (H5Tget_size(type) == 0)
- FAIL_STACK_ERROR;
- if (H5Tget_offset(type) < 0)
- FAIL_STACK_ERROR;
- if (H5Tget_sign(type) < 0)
- FAIL_STACK_ERROR;
- if (H5Tget_super(type) < 0)
- FAIL_STACK_ERROR;
-
+ TESTING("setters and getters with enumeration types");
+
+ /* Create an enum type for testing */
+ if ((tid = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "RED", CPTR(val, E1_RED)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "GREEN", CPTR(val, E1_GREEN)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "BLUE", CPTR(val, E1_BLUE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "WHITE", CPTR(val, E1_WHITE)) < 0)
+ TEST_ERROR;
+ if (H5Tenum_insert(tid, "BLACK", CPTR(val, E1_BLACK)) < 0)
+ TEST_ERROR;
+
+ /* These functions should work with enum datatypes */
+ if (H5Tget_precision(tid) == 0)
+ TEST_ERROR;
+ if (H5Tget_size(tid) == 0)
+ TEST_ERROR;
+ if (H5Tget_offset(tid) < 0)
+ TEST_ERROR;
+ if (H5Tget_sign(tid) < 0)
+ TEST_ERROR;
+ if (H5Tget_super(tid) < 0)
+ TEST_ERROR;
+
+ /* These functions should FAIL with enum datatypes */
H5E_BEGIN_TRY
{
- ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
+ ret = H5Tset_pad(tid, H5T_PAD_ZERO, H5T_PAD_ONE);
}
H5E_END_TRY;
- if (ret >= 0) {
- H5_FAILED();
- HDprintf("Operation not allowed for this type.\n");
- goto error;
- } /* end if */
+ if (ret >= 0)
+ FAIL_PUTS_ERROR("H5Tset_pad should not work with enum types");
H5E_BEGIN_TRY
{
- size = H5Tget_ebias(type);
+ size = H5Tget_ebias(tid);
}
H5E_END_TRY;
- if (size > 0) {
- H5_FAILED();
- HDprintf("Operation not allowed for this type.\n");
- goto error;
- } /* end if */
+ if (size > 0)
+ FAIL_PUTS_ERROR("H5Tget_ebias should not work with enum types");
H5E_BEGIN_TRY
{
- inpad = H5Tget_inpad(type);
+ inpad = H5Tget_inpad(tid);
}
H5E_END_TRY;
- if (inpad > -1) {
- H5_FAILED();
- HDprintf("Operation not allowed for this type.\n");
- goto error;
- } /* end if */
+ if (inpad > -1)
+ FAIL_PUTS_ERROR("H5Tget_inpad should not work with enum types");
H5E_BEGIN_TRY
{
- cset = H5Tget_cset(type);
+ cset = H5Tget_cset(tid);
}
H5E_END_TRY;
- if (cset > -1) {
- H5_FAILED();
- HDprintf("Operation not allowed for this type.\n");
- goto error;
- } /* end if */
+ if (cset > -1)
+ FAIL_PUTS_ERROR("H5Tget_cset should not work with enum types");
size = 16;
H5E_BEGIN_TRY
{
- ret = H5Tset_offset(type, (size_t)size);
+ ret = H5Tset_offset(tid, size);
}
H5E_END_TRY;
- if (ret >= 0) {
- H5_FAILED();
- HDprintf("Operation not allowed for this type.\n");
- goto error;
- } /* end if */
+ if (ret >= 0)
+ FAIL_PUTS_ERROR("H5Tset_offset should not work with enum types");
H5E_BEGIN_TRY
{
- ret = H5Tset_order(type, H5T_ORDER_BE);
+ ret = H5Tset_order(tid, H5T_ORDER_BE);
}
H5E_END_TRY;
- if (ret >= 0) {
- H5_FAILED();
- HDprintf("Operation not allowed for this type.\n");
- goto error;
- } /* end if */
+ if (ret >= 0)
+ FAIL_PUTS_ERROR("H5Tset_order should not work with enum types");
- if (H5Tclose(type) < 0)
+ if (H5Tclose(tid) < 0)
goto error;
PASSED();
@@ -729,61 +708,114 @@ test_funcs(void)
error:
H5E_BEGIN_TRY
{
- H5Tclose(type);
+ H5Tclose(tid);
}
H5E_END_TRY;
return 1;
}
/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose:
+ * Function: test_copying_empty_enum
*
- * Return: Success:
- *
- * Failure:
- *
- * Programmer: Robb Matzke
- * Tuesday, December 22, 1998
+ * Purpose: Test that copying an empty enum works, including implicitly
+ * when copying compound datatypes containing empty enums
*
+ * Return: Success: 0
+ * Failure: 1
*-------------------------------------------------------------------------
*/
+static int
+test_compound_insert_empty_enum(void)
+{
+ hid_t enum_id = H5I_INVALID_HID;
+ hid_t cmpd_id = H5I_INVALID_HID;
+ hid_t copy_id = H5I_INVALID_HID;
+ size_t size;
+
+ TESTING("copying empty enums works");
+
+ /* Create an empty enum */
+ if ((enum_id = H5Tenum_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR;
+
+ /* Copy the empty enum */
+ if ((copy_id = H5Tcopy(enum_id)) < 0)
+ TEST_ERROR;
+ if (H5Tclose(copy_id) < 0)
+ TEST_ERROR;
+
+ /* Create a compound datatype containing the empty enum */
+ size = H5Tget_size(H5T_NATIVE_LONG);
+ if ((cmpd_id = H5Tcreate(H5T_COMPOUND, size)) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(cmpd_id, "empty_enum", 0, enum_id))
+ TEST_ERROR;
+
+ /* Create a copy of the compound datatype */
+ if ((copy_id = H5Tcopy(cmpd_id)) < 0)
+ TEST_ERROR;
+ if (H5Tclose(copy_id) < 0)
+ TEST_ERROR;
+
+ if (H5Tclose(enum_id) < 0)
+ TEST_ERROR;
+ if (H5Tclose(cmpd_id) < 0)
+ TEST_ERROR;
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(enum_id);
+ H5Tclose(cmpd_id);
+ H5Tclose(copy_id);
+ }
+ H5E_END_TRY;
+ return 1;
+}
+
int
main(void)
{
- hid_t fapl = -1, file = -1;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
char name[1024];
int nerrors = 0;
h5_reset();
- fapl = h5_fileaccess();
+ fapl_id = h5_fileaccess();
/* Create the file */
- h5_fixname(FILENAME[0], fapl, name, sizeof name);
- if ((file = H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ h5_fixname(FILENAME[0], fapl_id, name, sizeof name);
+ if ((fid = H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
goto error;
/* Tests */
- nerrors += test_named(file);
- nerrors += test_conv(file);
- nerrors += test_tr1(file);
- nerrors += test_tr2(file);
+ nerrors += test_named(fid);
+ nerrors += test_conv(fid);
+ nerrors += test_tr1(fid);
+ nerrors += test_tr2(fid);
nerrors += test_value_dsnt_exist();
nerrors += test_funcs();
+ nerrors += test_compound_insert_empty_enum();
- H5Fclose(file);
+ if (H5Fclose(fid) < 0)
+ goto error;
/* Verify symbol table messages are cached */
- nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
+ nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0);
if (nerrors)
goto error;
+
HDputs("All enum tests passed.");
- h5_cleanup(FILENAME, fapl);
- return 0;
+ h5_cleanup(FILENAME, fapl_id);
+
+ return EXIT_SUCCESS;
error:
HDputs("*** ENUM TESTS FAILED ***");
- return 1;
+ return EXIT_FAILURE;
}
;); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.sh.log=.log) SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ AMTAR = @AMTAR@ # H5_CFLAGS holds flags that should be used when building hdf5, # but which should not be exported to h5cc for building other programs. # AM_CFLAGS is an automake construct which should be used by Makefiles # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ # Include src directory AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \ -I$(top_srcdir)/tools/lib AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@ AM_MAKEFLAGS = @AM_MAKEFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BYTESEX = @BYTESEX@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CC_VERSION = @CC_VERSION@ CFLAGS = @CFLAGS@ CLEARFILEBUF = @CLEARFILEBUF@ CODESTACK = @CODESTACK@ CONFIG_DATE = @CONFIG_DATE@ CONFIG_MODE = @CONFIG_MODE@ CONFIG_USER = @CONFIG_USER@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXX_VERSION = @CXX_VERSION@ CYGPATH_W = @CYGPATH_W@ DEBUG_PKG = @DEBUG_PKG@ DEFAULT_API_VERSION = @DEFAULT_API_VERSION@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXTERNAL_FILTERS = @EXTERNAL_FILTERS@ # Make sure that these variables are exported to the Makefiles F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ FC_VERSION = @FC_VERSION@ FGREP = @FGREP@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ H5_CXX_SHARED = @H5_CXX_SHARED@ H5_FCFLAGS = @H5_FCFLAGS@ H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ H5_LDFLAGS = @H5_LDFLAGS@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ HSIZE_T = @HSIZE_T@ HSSIZE_T = @HSSIZE_T@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTRUMENT = @INSTRUMENT@ INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@ LARGEFILE = @LARGEFILE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJECT_NAMELEN_DEFAULT_F = @OBJECT_NAMELEN_DEFAULT_F@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ RUNSERIAL = @RUNSERIAL@ R_INTEGER = @R_INTEGER@ R_LARGE = @R_LARGE@ SEARCH = @SEARCH@ SED = @SED@ SETX = @SETX@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIZE_T = @SIZE_T@ STATIC_EXEC = @STATIC_EXEC@ STATIC_SHARED = @STATIC_SHARED@ STRICT_FORMAT_CHECKS = @STRICT_FORMAT_CHECKS@ STRIP = @STRIP@ TESTPARALLEL = @TESTPARALLEL@ THREADSAFE = @THREADSAFE@ TIME = @TIME@ TR = @TR@ TRACE_API = @TRACE_API@ UNAME_INFO = @UNAME_INFO@ USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@ USE_FILTER_FLETCHER32 = @USE_FILTER_FLETCHER32@ USE_FILTER_NBIT = @USE_FILTER_NBIT@ USE_FILTER_SCALEOFFSET = @USE_FILTER_SCALEOFFSET@ USE_FILTER_SHUFFLE = @USE_FILTER_SHUFFLE@ USE_FILTER_SZIP = @USE_FILTER_SZIP@ USINGMEMCHECKER = @USINGMEMCHECKER@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ # Install directories that automake doesn't know about docdir = $(exec_prefix)/doc dvidir = @dvidir@ enable_shared = @enable_shared@ enable_static = @enable_static@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # Shell commands used in Makefiles RM = rm -f CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. # We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la LIBH5TEST = $(top_builddir)/test/libh5test.la LIBH5F = $(top_builddir)/fortran/src/libhdf5_fortran.la LIBH5FTEST = $(top_builddir)/fortran/test/libh5test_fortran.la LIBH5CPP = $(top_builddir)/c++/src/libhdf5_cpp.la LIBH5TOOLS = $(top_builddir)/tools/lib/libh5tools.la LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la # Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below # has been removed. According to the official description of DESTDIR by Gnu at # http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is # prepended to the normal and complete install path that it precedes for the # purpose of installing in a temporary directory which is useful for building # rpms and other packages. The '/' after ${DESTDIR} will be followed by another # '/' at the beginning of the normal install path. When DESTDIR is empty the # path then begins with '//', which is incorrect and causes problems at least for # Cygwin. # Scripts used to build examples # If only shared libraries have been installed, have h5cc build examples with # shared libraries instead of static libraries H5CC = ${DESTDIR}$(bindir)/h5cc H5CC_PP = ${DESTDIR}$(bindir)/h5pcc H5FC = ${DESTDIR}$(bindir)/h5fc H5FC_PP = ${DESTDIR}$(bindir)/h5pfc H5CPP = ${DESTDIR}$(bindir)/h5c++ ACLOCAL_AMFLAGS = "-I m4" # The trace script; this is used on source files from the C library to # insert tracing macros. TRACE = perl $(top_srcdir)/bin/trace # .chkexe files are used to mark tests that have run successfully. # .chklog files are output from those tests. # *.clog are from the MPE option. # Temporary files. *.h5 are generated by h5repart_gentest. They should # copied to the testfiles/ directory if update is required. fst_family*.h5 # and scd_family*.h5 were created by setting the HDF5_NOCLEANUP variable. CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 \ ../testfiles/fst_family*.h5 ../testfiles/scd_family*.h5 #test script and program TEST_PROG = h5repart_gentest talign TEST_SCRIPT = testh5repart.sh testh5mkgrp.sh check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = h5repart$(EXEEXT) h5mkgrp$(EXEEXT) bin_SCRIPTS = h5redeploy # Add h5debug, h5repart, and h5mkgrp specific linker flags here h5debug_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) h5repart_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) h5mkgrp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # Tell automake to clean h5redeploy script CLEANFILES = h5redeploy # These were generated by configure. Remove them only when distclean. DISTCLEANFILES = h5cc testh5repart.sh # All programs rely on hdf5 library and h5tools library LDADD = $(LIBH5TOOLS) $(LIBHDF5) @BUILD_PARALLEL_CONDITIONAL_FALSE@H5CC_NAME = h5cc # h5cc needs custom install and uninstall rules, since it may be # named h5pcc if hdf5 is being built in parallel mode. @BUILD_PARALLEL_CONDITIONAL_TRUE@H5CC_NAME = h5pcc # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., # lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and # EXTRA_TEST variables are supplied to allow the user to force targets to # be built at certain times. LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \ $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB) PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \ $(EXTRA_PROG) chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) TEST_EXTENSIONS = .sh SH_LOG_COMPILER = $(SHELL) AM_SH_LOG_FLAGS = TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_) TEST_PROG_PARA_CHKEXE = $(TEST_PROG_PARA:=.chkexe_) TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_) TEST_SCRIPT_PARA_CHKSH = $(TEST_SCRIPT_PARA:=.chkexe_) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .sh .sh$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/misc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign tools/misc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): h5cc: $(top_builddir)/config.status $(srcdir)/h5cc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testh5mkgrp.sh: $(top_builddir)/config.status $(srcdir)/testh5mkgrp.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testh5repart.sh: $(top_builddir)/config.status $(srcdir)/testh5repart.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list h5debug$(EXEEXT): $(h5debug_OBJECTS) $(h5debug_DEPENDENCIES) $(EXTRA_h5debug_DEPENDENCIES) @rm -f h5debug$(EXEEXT) $(AM_V_CCLD)$(h5debug_LINK) $(h5debug_OBJECTS) $(h5debug_LDADD) $(LIBS) h5mkgrp$(EXEEXT): $(h5mkgrp_OBJECTS) $(h5mkgrp_DEPENDENCIES) $(EXTRA_h5mkgrp_DEPENDENCIES) @rm -f h5mkgrp$(EXEEXT) $(AM_V_CCLD)$(h5mkgrp_LINK) $(h5mkgrp_OBJECTS) $(h5mkgrp_LDADD) $(LIBS) h5repart$(EXEEXT): $(h5repart_OBJECTS) $(h5repart_DEPENDENCIES) $(EXTRA_h5repart_DEPENDENCIES) @rm -f h5repart$(EXEEXT) $(AM_V_CCLD)$(h5repart_LINK) $(h5repart_OBJECTS) $(h5repart_LDADD) $(LIBS) h5repart_gentest$(EXEEXT): $(h5repart_gentest_OBJECTS) $(h5repart_gentest_DEPENDENCIES) $(EXTRA_h5repart_gentest_DEPENDENCIES) @rm -f h5repart_gentest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(h5repart_gentest_OBJECTS) $(h5repart_gentest_LDADD) $(LIBS) repart_test$(EXEEXT): $(repart_test_OBJECTS) $(repart_test_DEPENDENCIES) $(EXTRA_repart_test_DEPENDENCIES) @rm -f repart_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(repart_test_OBJECTS) $(repart_test_LDADD) $(LIBS) talign$(EXEEXT): $(talign_OBJECTS) $(talign_DEPENDENCIES) $(EXTRA_talign_DEPENDENCIES) @rm -f talign$(EXEEXT) $(AM_V_CCLD)$(LINK) $(talign_OBJECTS) $(talign_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5debug.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5mkgrp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5repart.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5repart_gentest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/repart_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/talign.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 recheck: all $(check_PROGRAMS) $(check_SCRIPTS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? h5repart_gentest.log: h5repart_gentest$(EXEEXT) @p='h5repart_gentest$(EXEEXT)'; \ b='h5repart_gentest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) talign.log: talign$(EXEEXT) @p='talign$(EXEEXT)'; \ b='talign'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .sh.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.sh$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) $(SCRIPTS) all-local installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-binSCRIPTS \ install-exec-local install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ uninstall-local .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \ check-am clean clean-binPROGRAMS clean-checkPROGRAMS \ clean-generic clean-libtool cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-binSCRIPTS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-exec-local \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-local # List all build rules defined by HDF5 Makefiles as "PHONY" targets here. # This tells the Makefiles that these targets are not files to be built but # commands that should be executed even if a file with the same name already # exists. .PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ build-tests check-clean check-install check-p check-s check-vfd \ install-doc lib progs tests uninstall-doc _exec_check-s _test help help: @$(top_srcdir)/bin/makehelp install-exec-local: @$(INSTALL) h5cc $(DESTDIR)$(bindir)/$(H5CC_NAME) uninstall-local: @$(RM) $(DESTDIR)$(bindir)/$(H5CC_NAME) # How to build h5redeploy script h5redeploy: h5redeploy.in @cp $(srcdir)/$@.in $@ # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. build-lib: $(LIB) build-progs: $(LIB) $(PROGS) build-tests: $(LIB) $(PROGS) $(chk_TESTS) # General rule for recursive building targets. # BUILT_SOURCES contain targets that need to be built before anything else # in the directory (e.g., for Fortran type detection) lib progs tests check-s check-p :: $(BUILT_SOURCES) @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; @for d in X $(SUBDIRS); do \ if test $$d != X && test $$d != .; then \ (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ fi; \ done # General rule for recursive cleaning targets. Like the rule above, # but doesn't require building BUILT_SOURCES. check-clean :: @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; @for d in X $(SUBDIRS); do \ if test $$d != X && test $$d != .; then \ (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ fi; \ done # Tell Automake to build tests when the user types `make all' (this is # not its default behavior). Also build EXTRA_LIB and EXTRA_PROG since # Automake won't build them automatically, either. all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS) # make install-doc doesn't do anything outside of doc directory, but # Makefiles should recognize it. # UPDATE: docs no longer reside in this build tree, so this target # is depreciated. install-doc uninstall-doc: @echo "Nothing to be done." # clean up files generated by tests so they can be re-run. build-check-clean: $(RM) -rf $(CHECK_CLEANFILES) # run check-clean whenever mostlyclean is run mostlyclean-local: build-check-clean # check-install is just a synonym for installcheck check-install: installcheck # Run each test in order, passing $(TEST_FLAGS) to the program. # Since tests are done in a shell loop, "make -i" does apply inside it. # Set HDF5_Make_Ignore to a non-blank string to ignore errors inside the loop. # The timestamps give a rough idea how much time the tests use. # # Note that targets in chk_TESTS (defined above) will be built when the user # types 'make tests' or 'make check', but only programs in TEST_PROG, # TEST_PROG_PARA, or TEST_SCRIPT will actually be executed. check-TESTS: test test _test: @$(MAKE) build-check-s @$(MAKE) build-check-p # Actual execution of check-s. build-check-s: $(LIB) $(PROGS) $(chk_TESTS) @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \ echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ fi @$(MAKE) $(AM_MAKEFLAGS) _exec_check-s @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \ echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ fi _exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH) # The dummy.chkexe here prevents the target from being # empty if there are no tests in the current directory. # $${log} is the log file. # $${tname} is the name of test. $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \ tname=$(@:.chkexe_=)$(EXEEXT);\ log=$(@:.chkexe_=.chklog); \ echo "============================"; \ if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \ echo "No need to test $${tname} again."; \ else \ echo "============================" > $${log}; \ if test "X$(FORTRAN_API)" = "Xyes"; then \ echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ elif test "X$(CXX_API)" = "Xyes"; then \ echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\ else \ echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ echo "" >> $${log}; \ echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ echo "============================" >> $${log}; \ echo "Finished testing $${tname} $(TEST_FLAGS)"; \ cat $${log}; \ fi; \ fi # The dummysh.chkexe here prevents the target from being # empty if there are no tests in the current directory. # $${log} is the log file. # $${tname} is the name of test. $(TEST_SCRIPT_CHKSH) $(TEST_SCRIPT_PARA_CHKSH) dummysh.chkexe_: @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \ cmd=$(@:.chkexe_=);\ tname=`basename $$cmd`;\ chkname=`basename $(@:.chkexe_=.chkexe)`;\ log=`basename $(@:.chkexe_=.chklog)`; \ echo "============================"; \ if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \ echo "No need to test $${tname} again."; \ else \ echo "============================" > $${log}; \ if test "X$(FORTRAN_API)" = "Xyes"; then \ echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \ echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ elif test "X$(CXX_API)" = "Xyes"; then \ echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \ echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ else \ echo "Testing $${tname} $(TEST_FLAGS)"; \ echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ fi; \ echo "============================" >> $${log}; \ RUNSERIAL="$(RUNSERIAL)" RUNPARALLEL="$(RUNPARALLEL)" \ srcdir="$(srcdir)" \ $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $${chkname} || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ echo "" >> $${log}; \ echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ echo "============================" >> $${log}; \ echo "Finished testing $${tname} $(TEST_FLAGS)"; \ cat $${log}; \ fi; \ echo "============================"; \ fi # Actual execution of check-p. build-check-p: $(LIB) $(PROGS) $(chk_TESTS) @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ fi @if test -n "$(TEST_PROG_PARA)"; then \ echo "**** Hint ****"; \ echo "Parallel test files reside in the current directory" \ "by default."; \ echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \ echo " HDF5_PARAPREFIX=/PFS/user/me"; \ echo " export HDF5_PARAPREFIX"; \ echo " make check"; \ echo "**** end of Hint ****"; \ fi @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ || exit 1; \ fi; \ done @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ fi # Run test with different Virtual File Driver check-vfd: $(LIB) $(PROGS) $(chk_TESTS) @for vfd in $(VFD_LIST) dummy; do \ if test $$vfd != dummy; then \ echo "============================"; \ echo "Testing Virtual File Driver $$vfd"; \ echo "============================"; \ $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \ HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ fi; \ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: