summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-04-21 22:46:38 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-04-21 22:46:38 (GMT)
commit5bb857476f99118cda0e54ea522f52933a582747 (patch)
tree741024b69250fe9166091aa8f28bc78c35d3fb64 /test
parent35bbc743d4cf77d6aa8af2acf5578db02e5129ca (diff)
downloadhdf5-5bb857476f99118cda0e54ea522f52933a582747.zip
hdf5-5bb857476f99118cda0e54ea522f52933a582747.tar.gz
hdf5-5bb857476f99118cda0e54ea522f52933a582747.tar.bz2
[svn-r16825] Description:
Bring revisions 16636:16821 from trunk to revise_chunks branch Tested on: FreeBSD/32 6.3 (duty) Mac OS X/32 10.5.6 (amazon) (h5committest not needed on this branch)
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am3
-rw-r--r--test/Makefile.in13
-rw-r--r--test/dsets.c45
-rw-r--r--test/dtransform.c59
-rw-r--r--test/family_v16_00000.h5bin5120 -> 5120 bytes
-rw-r--r--test/links.c84
-rwxr-xr-xtest/objcopy.c25
-rw-r--r--test/tfile.c65
-rw-r--r--test/tid.c43
-rw-r--r--test/tmisc.c82
-rw-r--r--test/tskiplist.c92
-rw-r--r--test/vfd.c56
12 files changed, 481 insertions, 86 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index ae54149..1acf00f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -117,7 +117,8 @@ CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offset.h5 \
enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \
tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin \
getname.h5 getname[1-3].h5 sec2_file.h5 direct_file.h5 \
- family_file000[0-3][0-9].h5 multi_file-[rs].h5 core_file \
+ family_file000[0-3][0-9].h5 new_family_v16_000[0-3][0-9].h5 \
+ multi_file-[rs].h5 core_file \
new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
unlink_chunked.h5 btree2.h5 objcopy_src.h5 objcopy_dst.h5 \
diff --git a/test/Makefile.in b/test/Makefile.in
index 8c44d5a..50a17b1 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -643,8 +643,9 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \
tvlstr.h5 tvlstr2.h5 flush.h5 enum1.h5 titerate.h5 ttsafe.h5 \
tarray1.h5 tgenprop.h5 tmisc[0-9]*.h5 set_extent[1-5].h5 \
ext[12].bin getname.h5 getname[1-3].h5 sec2_file.h5 \
- direct_file.h5 family_file000[0-3][0-9].h5 multi_file-[rs].h5 \
- core_file new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 \
+ direct_file.h5 family_file000[0-3][0-9].h5 \
+ new_family_v16_000[0-3][0-9].h5 multi_file-[rs].h5 core_file \
+ new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 \
err_compat.h5 dtransform.h5 test_filters.h5 get_file_name.h5 \
tstint[1-2].h5 unlink_chunked.h5 btree2.h5 objcopy_src.h5 \
objcopy_dst.h5 objcopy_ext.dat trefer1.h5 trefer2.h5 \
@@ -731,8 +732,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -1090,7 +1091,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/test/dsets.c b/test/dsets.c
index 2bb124f..13e22f5 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -106,6 +106,7 @@ const char *FILENAME[] = {
#define DSET_DEPREC_NAME "deprecated"
#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked"
#define DSET_DEPREC_NAME_COMPACT "deprecated_compact"
+#define DSET_DEPREC_NAME_FILTER "deprecated_filter"
#define USER_BLOCK 1024
#define SIXTY_FOUR_KB 65536
@@ -114,6 +115,7 @@ const char *FILENAME[] = {
#define H5Z_FILTER_BOGUS 305
#define H5Z_FILTER_CORRUPT 306
#define H5Z_FILTER_BOGUS2 307
+#define H5Z_FILTER_DEPREC 308
/* Flags for testing filters */
#define DISABLE_FLETCHER32 0
@@ -1032,7 +1034,7 @@ test_tconv(hid_t file)
}
/* This message derives from H5Z */
-const H5Z_class_t H5Z_BOGUS[1] = {{
+const H5Z_class2_t H5Z_BOGUS[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_BOGUS, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
@@ -1206,7 +1208,7 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts,
}
/* This message derives from H5Z */
-const H5Z_class_t H5Z_CORRUPT[1] = {{
+const H5Z_class2_t H5Z_CORRUPT[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_CORRUPT, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
@@ -4803,7 +4805,7 @@ test_types(hid_t file)
}
/* This message derives from H5Z */
-const H5Z_class_t H5Z_CAN_APPLY_TEST[1] = {{
+const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{
H5Z_CLASS_T_VERS,
H5Z_FILTER_BOGUS, /* Filter id number */
1, 1,
@@ -5163,7 +5165,7 @@ error:
/* This message derives from H5Z */
-const H5Z_class_t H5Z_SET_LOCAL_TEST[1] = {{
+const H5Z_class2_t H5Z_SET_LOCAL_TEST[1] = {{
H5Z_CLASS_T_VERS,
H5Z_FILTER_BOGUS2, /* Filter id number */
1, 1,
@@ -6191,6 +6193,28 @@ error:
} /* end test_random_chunks() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
+/* Empty can_apply and set_local callbacks */
+static herr_t
+can_apply_deprec(hid_t UNUSED dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id)
+{
+ return 1;
+}
+
+static herr_t
+set_local_deprec(hid_t UNUSED dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id)
+{
+ return(SUCCEED);
+}
+
+/* Old style H5Z_class_t, essentially a copy of the "bogus" filter */
+const H5Z_class1_t H5Z_DEPREC[1] = {{
+ H5Z_FILTER_DEPREC, /* Filter id number */
+ "deprec", /* Filter name for debugging */
+ can_apply_deprec, /* The "can apply" callback */
+ set_local_deprec, /* The "set local" callback */
+ filter_bogus, /* The actual filter function */
+}};
+
/*-------------------------------------------------------------------------
* Function: test_deprec
@@ -6208,8 +6232,9 @@ error:
static herr_t
test_deprec(hid_t file)
{
- hid_t dataset, space, small_space, create_parms;
+ hid_t dataset, space, small_space, create_parms, dcpl;
hsize_t dims[2], small_dims[2];
+ hsize_t deprec_size;
herr_t status;
hsize_t csize[2];
@@ -6363,6 +6388,16 @@ test_deprec(hid_t file)
if((dataset = H5Dopen1(file, DSET_DEPREC_NAME_COMPACT)) < 0) goto error;
if(H5Dclose(dataset) < 0) goto error;
+ /* Test H5Zregister with deprecated H5Z_class1_t */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if(H5Pset_chunk(dcpl, 2, csize) < 0) goto error;
+ if(H5Zregister(H5Z_DEPREC) < 0) goto error;
+ if(H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0) goto error;
+
+ if(test_filter_internal(file,DSET_DEPREC_NAME_FILTER,dcpl,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deprec_size) < 0) goto error;
+
+ if(H5Pclose(dcpl) < 0) goto error;
+
PASSED();
return 0;
diff --git a/test/dtransform.c b/test/dtransform.c
index 8b5dce0..cb58a6c 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -50,17 +50,17 @@ const float windchillFfloat[ROWS][COLS] =
const int transformData[ROWS][COLS] =
{ {36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, 28, 34, 40, 46, 52, 57, 63 },
- {34, 27, 21, 15, 9, 3, 4, 10, 16, 22, 28, 35, 41, 47, 53, 59, 66, 72 } ,
- {32, 25, 19, 13, 6, 0, 7, 13, 19, 26, 32, 39, 45, 51, 58, 64, 71, 77 },
- {30, 24, 17, 11, 4, 2, 9, 15, 22, 29, 35, 42, 48, 55, 61, 68, 74, 81 },
- {29, 23, 16, 9, 3, 4, 11, 17, 24, 31, 37, 44, 51, 58, 64, 71, 78, 84 },
- {28, 22, 15, 8, 1, 5, 12, 19, 26, 33, 39, 46, 53, 60, 67, 73, 80, 87 },
- {28, 21, 14, 7, 0, 7, 14, 21, 27, 34, 41, 48, 55, 62, 69, 76, 82, 89 },
- {27, 20, 13, 6, 1, 8, 15, 22, 29, 36, 43, 50, 57, 64, 71, 78, 84, 91 },
- {26, 19, 12, 5, 2, 9, 16, 23, 30, 37, 44, 51, 58, 65, 72, 79, 86, 93 },
- {26, 19, 12, 4, 3, 10, 17, 24, 31, 38, 45, 52, 60, 67, 74, 81, 88, 95},
- {25, 18, 11, 4, 3, 11, 18, 25, 32, 39, 46, 54, 61, 68, 75, 82, 89, 97},
- {25, 17, 10, 3, 4, 11, 19, 26, 33, 40, 48, 55, 62, 69, 76, 84, 91, 98}
+ {34, 27, 21, 15, 9, 3, 4, 10, 16, 22, 28, 35, 41, 47, 53, 59, 66, 0 } ,
+ {32, 25, 19, 13, 6, 0, 7, 13, 19, 26, 32, 39, 45, 51, 58, 64, 71, 5 },
+ {30, 24, 17, 11, 4, 2, 9, 15, 22, 29, 35, 42, 48, 55, 61, 68, 2, 9 },
+ {29, 23, 16, 9, 3, 4, 11, 17, 24, 31, 37, 44, 51, 58, 64, 71, 6, 12 },
+ {28, 22, 15, 8, 1, 5, 12, 19, 26, 33, 39, 46, 53, 60, 67, 1, 8, 15 },
+ {28, 21, 14, 7, 0, 7, 14, 21, 27, 34, 41, 48, 55, 62, 69, 4, 10, 17 },
+ {27, 20, 13, 6, 1, 8, 15, 22, 29, 36, 43, 50, 57, 64, 71, 6, 12, 19 },
+ {26, 19, 12, 5, 2, 9, 16, 23, 30, 37, 44, 51, 58, 65, 0, 7, 14, 21 },
+ {26, 19, 12, 4, 3, 10, 17, 24, 31, 38, 45, 52, 60, 67, 2, 9, 16, 23},
+ {25, 18, 11, 4, 3, 11, 18, 25, 32, 39, 46, 54, 61, 68, 3, 10, 17, 25},
+ {25, 17, 10, 3, 4, 11, 19, 26, 33, 40, 48, 55, 62, 69, 4, 12, 19, 26}
};
#define UCOMPARE(TYPE,VAR1,VAR2,TOL) \
@@ -104,17 +104,25 @@ const int transformData[ROWS][COLS] =
/* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit into uchar */ \
const char* utrans = "((x+100)/4)*3"; \
\
- hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, dset; \
+ hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, dset, dset_nn, dt_nn; \
+ H5T_order_t order; \
hsize_t dim[2] = {ROWS, COLS}; \
\
if((dataspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR; \
- if((dset = H5Dcreate2(file_id, "/transformtest_"TEST_STR, HDF_TYPE, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; \
+ if((dset = H5Dcreate2(file_id, "/transformtest_"TEST_STR, HDF_TYPE, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; \
+ \
+ if((dt_nn = H5Tcopy(HDF_TYPE)) < 0) TEST_ERROR \
+ if((order = H5Tget_order(dt_nn)) == H5T_ORDER_ERROR) TEST_ERROR \
+ if(H5Tset_order(dt_nn, order == H5T_ORDER_LE ? H5T_ORDER_BE : H5T_ORDER_LE) < 0) TEST_ERROR \
+ if((dset_nn = H5Dcreate2(file_id, "/nonnative_transformtest_"TEST_STR, dt_nn, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR \
+ if(H5Tclose(dt_nn) < 0) TEST_ERROR \
\
if(SIGNED) \
{ \
if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \
if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) TEST_ERROR; \
if(H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR; \
+ if(H5Dwrite(dset_nn, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR; \
if(H5Pclose(dxpl_id_f_to_c) < 0) TEST_ERROR; \
} \
else \
@@ -122,6 +130,7 @@ const int transformData[ROWS][COLS] =
if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \
if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) TEST_ERROR; \
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData) < 0) TEST_ERROR; \
+ if(H5Dwrite(dset_nn, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData) < 0) TEST_ERROR; \
if(H5Pclose(dxpl_id_utrans) < 0) TEST_ERROR; \
} \
\
@@ -133,16 +142,21 @@ const int transformData[ROWS][COLS] =
COMPARE(TYPE, array, COMPARE_DATA, 2) \
else \
UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
+ \
+ TESTING("contiguous, byte order conversion ("TEST_STR"->"TEST_STR")") \
+ \
+ if(H5Dread(dset_nn, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \
+ if(SIGNED) \
+ COMPARE(TYPE, array, COMPARE_DATA, 2) \
+ else \
+ UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
\
if(SIGNED) \
{ \
TESTING("contiguous, with type conversion (float->"TEST_STR")") \
\
if(H5Dread(dset_id_float, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \
- if(SIGNED) \
- COMPARE(TYPE, array, COMPARE_DATA, 2) \
- else \
- UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
+ COMPARE(TYPE, array, COMPARE_DATA, 2) \
} \
\
if(H5Dclose(dset) < 0) TEST_ERROR; \
@@ -200,10 +214,7 @@ const int transformData[ROWS][COLS] =
TESTING("chunked, with type conversion (float->"TEST_STR")") \
\
if(H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) TEST_ERROR; \
- if(SIGNED) \
- COMPARE(TYPE, array, COMPARE_DATA, 2) \
- else \
- UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
+ COMPARE(TYPE, array, COMPARE_DATA, 2) \
} \
\
\
@@ -516,7 +527,7 @@ test_getset(const hid_t dxpl_id_c_to_f)
float windchillFfloatread[ROWS][COLS];
const char* simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
const char* c_to_f = "(9/5.0)*x + 32";
- char* ptrgetTest = HDmalloc(HDstrlen(simple)+1);
+ char* ptrgetTest = (char *) HDmalloc(HDstrlen(simple)+1);
TESTING("H5Pget_data_transform")
H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(c_to_f)+1);
@@ -549,7 +560,7 @@ test_getset(const hid_t dxpl_id_c_to_f)
PASSED();
- ptrgetTest = malloc(strlen(simple)+1);
+ ptrgetTest = (char *) malloc(strlen(simple)+1);
HDmemset(ptrgetTest, 0, strlen(simple)+1);
TESTING("H5Pget_data_transform, after resetting transform property")
@@ -577,7 +588,7 @@ test_set(void)
hid_t dxpl_id;
H5E_auto2_t func;
const char* str = "(9/5.0)*x + 32";
- char* ptrgetTest = malloc(strlen(str)+1);
+ char* ptrgetTest = (char *) malloc(strlen(str)+1);
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
diff --git a/test/family_v16_00000.h5 b/test/family_v16_00000.h5
index bf1a711..ac75ea9 100644
--- a/test/family_v16_00000.h5
+++ b/test/family_v16_00000.h5
Binary files differ
diff --git a/test/links.c b/test/links.c
index c169670..1d64dd9 100644
--- a/test/links.c
+++ b/test/links.c
@@ -81,6 +81,7 @@ const char *FILENAME[] = {
"extlinks18B", /* 41: */
"extlinks19A", /* 42: */
"extlinks19B", /* 43: */
+ "extlinks20", /* 44: */
NULL
};
@@ -131,6 +132,7 @@ const char *FILENAME[] = {
"extlinks18B", /* 41: */
"extlinks19A", /* 42: */
"extlinks19B", /* 43: */
+ "extlinks20", /* 44: */
NULL
};
@@ -4218,8 +4220,8 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
if (H5Pset_fapl_family(fam_fapl, op_data.fam_size, op_data.base_fapl) < 0) TEST_ERROR
/* Create parent and target files, group, and external link */
- h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1);
- h5_fixname(FILENAME[41], fam_fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[42], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[43], fam_fapl, filename2, sizeof filename2);
if ((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
if ((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR
if ((group = H5Gcreate2(file1, "group1",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -4297,6 +4299,67 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
} /* end external_set_elink_cb() */
+/*-------------------------------------------------------------------------
+ * Function: external_reset_register
+ *
+ * Purpose: Check that external links are registered after the library
+ * is reset.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * Apr. 9, 2009
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+external_reset_register(void)
+{
+ hid_t file;
+ char filename[NAME_BUF_SIZE];
+
+ TESTING("external links are registered after reset")
+
+ /* Create and close file */
+ h5_fixname(FILENAME[44], H5P_DEFAULT, filename, sizeof filename);
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Fclose(file) < 0) TEST_ERROR
+
+ /* Reset the library */
+ H5close();
+
+ /* Re open file */
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Create an external link */
+ if (H5Lcreate_external("some_file", "some_obj", file, "ext_link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close file */
+ if (H5Fclose(file) < 0) TEST_ERROR
+
+ /* Try again to make sure the previous H5Lcreate_external call does not
+ * affect the ability to reset */
+ H5close();
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Lcreate_external("another_file", "another_obj", file, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fclose(file) < 0) TEST_ERROR
+
+ if(HDremove(filename) != 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+ error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return -1;
+} /* end external_reset_register() */
+
+
#ifdef H5_HAVE_WINDOW_PATH
/*-------------------------------------------------------------------------
@@ -7177,6 +7240,14 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ /* Try to create internally defined links with H5Lcreate_ud */
+ H5E_BEGIN_TRY {
+ if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, 0, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", 4, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ } H5E_END_TRY
+
/* Create a user-defined link to the group. */
strcpy(group_name, "/group");
if(H5Lcreate_ud(fid, "/ud_link", UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
@@ -12753,6 +12824,13 @@ main(void)
/* Close 2nd FAPL */
H5Pclose(fapl2);
+ h5_cleanup(FILENAME, fapl);
+
+ /* Test that external links can be used after a library reset. MUST be
+ * called last so the reset doesn't interfere with the property lists. This
+ * routine will delete its own file. */
+ nerrors += external_reset_register() < 0 ? 1 : 0;
+
/* Results */
if(nerrors) {
printf("***** %d LINK TEST%s FAILED! *****\n",
@@ -12761,8 +12839,6 @@ main(void)
}
printf("All link tests passed.\n");
- h5_cleanup(FILENAME, fapl);
-
/* clean up tmp directory created by external link tests */
HDrmdir(TMPDIR);
diff --git a/test/objcopy.c b/test/objcopy.c
index c2d71c0..4bd4662 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -7451,6 +7451,10 @@ main(void)
hid_t fcpl_src;
hid_t fcpl_dst;
+ /* No need to test dense attributes with old format */
+ if(!(configuration & CONFIG_NEW_FORMAT) && (configuration & CONFIG_DENSE))
+ continue;
+
/* Test with and without shared messages */
if(configuration & CONFIG_SHARE_SRC) {
puts("\nTesting with shared src messages:");
@@ -7473,22 +7477,23 @@ main(void)
if(configuration & CONFIG_NEW_FORMAT) {
puts("Testing with new group format:");
my_fapl = fapl2;
+
+ /* Test with and without dense attributes */
+ if(configuration & CONFIG_DENSE) {
+ puts("Testing with dense attributes:");
+ num_attributes_g = max_compact + 1;
+ }
+ else {
+ puts("Testing without dense attributes:");
+ num_attributes_g = MAX(min_dense, 2) - 1;
+ }
} /* end if */
else {
puts("Testing with old group format:");
my_fapl = fapl;
+ num_attributes_g = 4;
} /* end else */
- /* Test with and without dense attributes */
- if(configuration & CONFIG_DENSE) {
- puts("Testing with dense attributes:");
- num_attributes_g = max_compact + 1;
- }
- else {
- puts("Testing without dense attributes:");
- num_attributes_g = MAX(min_dense, 2) - 1;
- }
-
/* The tests... */
nerrors += test_copy_dataset_simple(fcpl_src, fcpl_dst, my_fapl);
nerrors += test_copy_dataset_simple_samefile(fcpl_src, my_fapl);
diff --git a/test/tfile.c b/test/tfile.c
index 724ad4a..68c7f6b 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -27,6 +27,14 @@
#include "H5Bprivate.h"
#include "H5Pprivate.h"
+/*
+ * This file needs to access private information from the H5F package.
+ * This file also needs to access the file testing code.
+ */
+#define H5F_PACKAGE
+#define H5F_TESTING
+#include "H5Fpkg.h" /* File access */
+
#define F1_USERBLOCK_SIZE (hsize_t)0
#define F1_OFFSET_SIZE sizeof(haddr_t)
#define F1_LENGTH_SIZE sizeof(hsize_t)
@@ -1931,9 +1939,9 @@ test_userblock_file_size(void)
/* Reopen files */
file1_id = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Fopen");
+ CHECK(file1_id, FAIL, "H5Fopen");
file2_id = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Fopen");
+ CHECK(file2_id, FAIL, "H5Fopen");
/* Check file sizes */
ret = H5Fget_filesize(file1_id, &filesize1);
@@ -1952,9 +1960,9 @@ test_userblock_file_size(void)
/* Reopen files */
file1_id = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Fopen");
+ CHECK(file1_id, FAIL, "H5Fopen");
file2_id = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Fopen");
+ CHECK(file2_id, FAIL, "H5Fopen");
/* Verify file sizes did not change */
ret = H5Fget_filesize(file1_id, &filesize);
@@ -1973,6 +1981,52 @@ test_userblock_file_size(void)
/****************************************************************
**
+** test_cached_stab_info(): low-level file test routine.
+** This test checks that new files are created with cached
+** symbol table information in the superblock (when using
+** the old format). This is necessary to ensure backwards
+** compatibility with versions from 1.3.0 to 1.6.3.
+**
+*****************************************************************/
+static void
+test_cached_stab_info(void)
+{
+ hid_t file_id;
+ hid_t group_id;
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing cached symbol table information\n"));
+
+ /* Create file */
+ file_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fcreate");
+
+ /* Create group */
+ group_id = H5Gcreate2(file_id, GROUP1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group_id, FAIL, "H5Gcreate2");
+
+ /* Close file and group */
+ ret = H5Gclose(group_id);
+ CHECK(ret, FAIL, "H5Gclose");
+ ret = H5Fclose(file_id);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Reopen file */
+ file_id = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Fopen");
+
+ /* Verify the cached symbol table information */
+ ret = H5F_check_cached_stab_test(file_id);
+ CHECK(ret, FAIL, "H5F_check_cached_stab_test");
+
+ /* Close file */
+ ret = H5Fclose(file_id);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* end test_cached_stab_info() */
+
+/****************************************************************
+**
** test_file(): Main low-level file I/O test routine.
**
****************************************************************/
@@ -2002,7 +2056,8 @@ test_file(void)
test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */
test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */
#endif /*H5_CANNOT_OPEN_TWICE*/
- test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */
+ test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */
+ test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */
} /* test_file() */
diff --git a/test/tid.c b/test/tid.c
index f3c00fc..9bb93e7 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -394,7 +394,7 @@ static int test_is_valid(void)
/* Check that an id of -1 is invalid */
tri_ret = H5Iis_valid(-1);
- VERIFY(tri_ret, FALSE, "H5Iis_valid");
+ VERIFY(tri_ret, FALSE, "H4Iis_valid");
if (tri_ret != FALSE)
goto out;
@@ -408,6 +408,46 @@ out:
return -1;
}
+/* Test the H5Iget_type function */
+static int test_get_type(void)
+{
+ hid_t dtype; /* datatype id */
+ H5I_type_t type_ret; /* return value */
+
+ /* Create a datatype id */
+ dtype = H5Tcopy(H5T_NATIVE_INT);
+ CHECK(dtype, FAIL, "H5Tcopy");
+ if (dtype < 0)
+ goto out;
+
+ /* Check that the ID is correct */
+ type_ret = H5Iget_type(dtype);
+ VERIFY(type_ret, H5I_DATATYPE, "H5Iget_type");
+ if (type_ret == H5I_BADID)
+ goto out;
+
+ /* Check that the ID is correct */
+ type_ret = H5Iget_type(H5T_STRING);
+ VERIFY(type_ret, H5I_BADID, "H5Iget_type");
+ if (type_ret != H5I_BADID)
+ goto out;
+
+ /* Check that the ID is correct */
+ type_ret = H5Iget_type(-1);
+ VERIFY(type_ret, H5I_BADID, "H5Iget_type");
+ if (type_ret != H5I_BADID)
+ goto out;
+
+ H5Tclose(dtype);
+
+ return 0;
+
+out:
+ if(dtype != H5I_INVALID_HID)
+ H5Tclose(dtype);
+
+ return -1;
+}
/* Test boundary cases with lots of types */
@@ -498,6 +538,7 @@ void test_ids(void)
if (basic_id_test() < 0) TestErrPrintf("Basic ID test failed\n");
if (id_predefined_test() < 0) TestErrPrintf("Predefined ID type test failed\n");
if (test_is_valid() < 0) TestErrPrintf("H5Iis_valid test failed\n");
+ if (test_get_type() < 0) TestErrPrintf("H5Iget_type test failed\n");
if (test_id_type_list() < 0) TestErrPrintf("ID type list test failed\n");
}
diff --git a/test/tmisc.c b/test/tmisc.c
index 4db800c..b646a69 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -3779,6 +3779,7 @@ test_misc23(void)
tmp_id=0, create_id=H5P_DEFAULT, access_id=H5P_DEFAULT;
char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */
H5O_info_t oinfo;
+ htri_t tri_status;
herr_t status;
/* Output message about test being performed */
@@ -4022,6 +4023,87 @@ test_misc23(void)
status = H5Pclose(create_id);
CHECK(status, FAIL, "H5Pclose");
+ /**********************************************************************
+ * test H5Lcopy()
+ **********************************************************************/
+
+ /* Create link creation property list */
+ create_id = H5Pcreate(H5P_LINK_CREATE);
+ CHECK(create_id, FAIL, "H5Pcreate");
+
+ /* Set flag for intermediate group creation */
+ status = H5Pset_create_intermediate_group(create_id, TRUE);
+ CHECK(status, FAIL, "H5Pset_create_intermediate_group");
+
+ status = H5Lcopy(file_id, "/A/B01/grp", file_id, "/A/B16/grp", create_id, access_id);
+ CHECK(status, FAIL, "H5Lcopy");
+
+ tri_status = H5Lexists(file_id, "/A/B16/grp", access_id);
+ VERIFY(tri_status, TRUE, "H5Lexists");
+
+ tri_status = H5Lexists(file_id, "/A/B01/grp", access_id);
+ VERIFY(tri_status, TRUE, "H5Lexists");
+
+ /**********************************************************************
+ * test H5Lmove()
+ **********************************************************************/
+
+ status = H5Lmove(file_id, "/A/B16/grp", file_id, "/A/B17/grp", create_id, access_id);
+ CHECK(status, FAIL, "H5Lmove");
+
+ tri_status = H5Lexists(file_id, "/A/B17/grp", access_id);
+ VERIFY(tri_status, TRUE, "H5Lexists");
+
+ tri_status = H5Lexists(file_id, "/A/B16/grp", access_id);
+ VERIFY(tri_status, FALSE, "H5Lexists");
+
+ /**********************************************************************
+ * test H5Lcreate_hard()
+ **********************************************************************/
+
+ status = H5Lcreate_hard(file_id, "/A/B01/grp", file_id, "/A/B18/grp", create_id, access_id);
+ CHECK(status, FAIL, "H5Lcreate_hard");
+
+ tri_status = H5Lexists(file_id, "/A/B18/grp", access_id);
+ VERIFY(tri_status, TRUE, "H5Lexists");
+
+ /**********************************************************************
+ * test H5Lcreate_soft()
+ **********************************************************************/
+
+ status = H5Lcreate_soft("/A/B01/grp", file_id, "/A/B19/grp", create_id, access_id);
+ CHECK(status, FAIL, "H5Lcreate_soft");
+
+ tri_status = H5Lexists(file_id, "/A/B19/grp", access_id);
+ VERIFY(tri_status, TRUE, "H5Lexists");
+
+ /**********************************************************************
+ * test H5Lcreate_external()
+ **********************************************************************/
+
+ status = H5Lcreate_external("fake_filename", "fake_path", file_id, "/A/B20/grp", create_id, access_id);
+ CHECK(status, FAIL, "H5Lcreate_external");
+
+ tri_status = H5Lexists(file_id, "/A/B20/grp", access_id);
+ VERIFY(tri_status, TRUE, "H5Lexists");
+
+ /**********************************************************************
+ * test H5Lcreate_ud()
+ **********************************************************************/
+
+ status = H5Lcreate_ud(file_id, "/A/B21/grp", H5L_TYPE_EXTERNAL, "file\0obj", (size_t) 9, create_id, access_id);
+ CHECK(status, FAIL, "H5Lcreate_ud");
+
+ tri_status = H5Lexists(file_id, "/A/B21/grp", access_id);
+ VERIFY(tri_status, TRUE, "H5Lexists");
+
+ /**********************************************************************
+ * close
+ **********************************************************************/
+
+ status = H5Pclose(create_id);
+ CHECK(status, FAIL, "H5Pclose");
+
status = H5Gclose(group_id);
CHECK(status, FAIL, "H5Gclose");
diff --git a/test/tskiplist.c b/test/tskiplist.c
index 289df0b..7b3dcef 100644
--- a/test/tskiplist.c
+++ b/test/tskiplist.c
@@ -121,7 +121,7 @@ test_skiplist_create(void)
MESSAGE(6, ("Testing Creating & Closing Skip Lists\n"));
/* Try creating a skip list */
- slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Try closing the skip list */
@@ -151,7 +151,7 @@ test_skiplist_insert(void)
MESSAGE(7, ("Testing Insertion Into Skip List\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@@ -212,7 +212,7 @@ test_skiplist_insert_many(void)
MESSAGE(7, ("Testing Insertion of Many Items Into Skip List\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@@ -286,7 +286,7 @@ test_skiplist_remove(void)
MESSAGE(7, ("Testing Removal From Skip List\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@@ -365,7 +365,7 @@ test_skiplist_remove_many(void)
MESSAGE(7, ("Testing Removal of Many Items From Skip List\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@@ -465,7 +465,7 @@ test_skiplist_firstnext(void)
MESSAGE(7, ("Testing Iterating Over Skip List With First/Next\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@@ -558,7 +558,7 @@ test_skiplist_string(void)
MESSAGE(7, ("Testing Skip List With String Keys\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_STR);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@@ -620,7 +620,7 @@ test_skiplist_iterate(void)
MESSAGE(7, ("Testing Iterating Over Skip List\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@@ -670,7 +670,7 @@ test_skiplist_hsize(void)
MESSAGE(7, ("Testing Skip List With hsize_t Keys\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_HSIZE, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_HSIZE);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@@ -725,7 +725,7 @@ test_skiplist_unsigned(void)
MESSAGE(7, ("Testing Skip List With unsigned Keys\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@@ -778,7 +778,7 @@ test_skiplist_lastprev(void)
MESSAGE(7, ("Testing Iterating Over Skip List With Last/Prev\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@@ -846,7 +846,7 @@ test_skiplist_find(void)
MESSAGE(7, ("Testing Skip List 'Find' Operation\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@@ -902,7 +902,7 @@ test_skiplist_add(void)
MESSAGE(7, ("Testing Skip List 'Add' Operation\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@@ -964,7 +964,7 @@ test_skiplist_destroy(void)
MESSAGE(7, ("Testing Skip List 'Destroy' Operation\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@@ -1000,7 +1000,7 @@ test_skiplist_free(void)
MESSAGE(7, ("Testing Skip List 'Free' Operation\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@@ -1056,7 +1056,7 @@ test_skiplist_less(void)
MESSAGE(7, ("Testing Skip List 'Less' Operation\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@@ -1120,7 +1120,7 @@ test_skiplist_greater(void)
MESSAGE(7, ("Testing Skip List 'Greater' Operation\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@@ -1182,10 +1182,10 @@ test_skiplist_below(void)
herr_t ret; /* Generic return value */
/* Output message about test being performed */
- MESSAGE(7, ("Testing Skip List 'Less' Operation\n"));
+ MESSAGE(7, ("Testing Skip List 'Below' Operation\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@@ -1261,10 +1261,10 @@ test_skiplist_above(void)
herr_t ret; /* Generic return value */
/* Output message about test being performed */
- MESSAGE(7, ("Testing Skip List 'Greater' Operation\n"));
+ MESSAGE(7, ("Testing Skip List 'Above' Operation\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@@ -1338,10 +1338,10 @@ test_skiplist_remove_first(void)
herr_t ret; /* Generic return value */
/* Output message about test being performed */
- MESSAGE(7, ("Testing Skip List 'Greater' Operation\n"));
+ MESSAGE(7, ("Testing Skip List 'Remove First' Operation\n"));
/* Create a skip list */
- slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
+ slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@@ -1368,6 +1368,51 @@ test_skiplist_remove_first(void)
/****************************************************************
**
+** test_skiplist_remote_first_many(): Test H5SL (skip list) code.
+** Tests 'remove first' operation in large skip lists.
+**
+****************************************************************/
+static void
+test_skiplist_remove_first_many(void)
+{
+ H5SL_t *slist; /* Skip list created */
+ size_t u; /* Local index variable */
+ int *found_item; /* Item found in skip list */
+ int prev_item = INT_MIN; /* Previously found item in skip list */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(7, ("Testing Skip List 'Remove First' Operation\n"));
+
+ /* Create a skip list */
+ slist = H5SL_create(H5SL_TYPE_INT);
+ CHECK(slist, NULL, "H5SL_create");
+
+ /* Insert objects into the skip list */
+ for(u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
+ CHECK(ret, FAIL, "H5SL_insert");
+ } /* end for */
+
+ /* Remove objects from the skip list */
+ for(u = 0; u < NUM_ELEMS; u++) {
+ found_item = (int *)H5SL_remove_first(slist);
+ VERIFY(*found_item > prev_item, TRUE, "H5SL_remove_first");
+ prev_item = *found_item;
+ } /* end for */
+
+ /* Check for removing object from empty list */
+ found_item = (int *)H5SL_remove_first(slist);
+ VERIFY(found_item, NULL, "H5SL_remove_first");
+
+ /* Close the skip list */
+ ret = H5SL_close(slist);
+ CHECK(ret, FAIL, "H5SL_close");
+
+} /* end test_skiplist_remove_first() */
+
+/****************************************************************
+**
** test_skiplist(): Main H5SL testing routine.
**
****************************************************************/
@@ -1401,6 +1446,7 @@ test_skiplist(void)
test_skiplist_below(); /* Test 'below' operation */
test_skiplist_above(); /* Test 'above' operation */
test_skiplist_remove_first(); /* Test 'remove first' operation */
+ test_skiplist_remove_first_many(); /* Test 'remove first' operation on large skip lists */
} /* end test_skiplist() */
diff --git a/test/vfd.c b/test/vfd.c
index 57798a5..c1de28d 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -28,6 +28,7 @@
#define FAMILY_SIZE2 (5*KB)
#define MULTI_SIZE 128
#define CORE_INCREMENT (4*KB)
+#define FILE_COPY_BUF_SIZE 4096
/*Macros for Direct VFD*/
#define MBOUNDARY 512
@@ -44,6 +45,7 @@ const char *FILENAME[] = {
"sec2_file",
"core_file",
"family_file",
+ "new_family_v16_",
"multi_file",
"direct_file",
NULL
@@ -173,7 +175,7 @@ test_direct(void)
fapl = h5_fileaccess();
if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
/* Verify the file access properties */
if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0)
@@ -805,8 +807,14 @@ test_family_compat(void)
hid_t dset;
char dname[]="dataset";
char filename[1024];
- char pathname[1024];
+ char pathname[1024], pathname_individual[1024];
+ char newname[1024], newname_individual[1024];
char *srcdir = getenv("srcdir"); /*where the src code is located*/
+ FILE *tmp_fp, *old_fp; /* Pointers to temp & old files */
+ void *copy_buf; /* Pointer to buffer for copying data */
+ size_t written; /* Amount of data written to new file */
+ size_t read_in; /* Amount of data read in from old file */
+ int counter = 0;
TESTING("FAMILY file driver backward compatibility");
@@ -817,6 +825,7 @@ test_family_compat(void)
TEST_ERROR;
h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[3], fapl, newname, sizeof newname);
pathname[0] = '\0';
/* Generate correct name for test file by prepending the source path */
@@ -826,9 +835,42 @@ test_family_compat(void)
}
HDstrcat(pathname, filename);
+ /* The following code makes the copies of the family files in the source directory.
+ * Since we're going to open the files with write mode, this protects the original
+ * files.
+ */
+ if(NULL == (copy_buf = HDmalloc((size_t)FILE_COPY_BUF_SIZE))) TEST_ERROR
+
+ sprintf(newname_individual, newname, counter);
+ sprintf(pathname_individual, pathname, counter);
+
+ /* Open the original files until no more left. Copy the content into the new files. */
+ while((old_fp = HDfopen(pathname_individual,"rb"))) {
+ /* Open the new file */
+ if(NULL == (tmp_fp = fopen(newname_individual,"wb"))) TEST_ERROR
+
+ /* Copy data from the old file to the new file */
+ while((read_in = HDfread(copy_buf, (size_t)1, (size_t)FILE_COPY_BUF_SIZE, old_fp)) > 0)
+ /* Write the data to the new file */
+ if(read_in != (written = HDfwrite(copy_buf, (size_t)1, read_in, tmp_fp))) TEST_ERROR
+
+ /* Close the old file */
+ if(HDfclose(old_fp)) TEST_ERROR
+
+ /* Close the new file */
+ if(HDfclose(tmp_fp)) TEST_ERROR
+
+ counter++;
+ sprintf(newname_individual, newname, counter);
+ sprintf(pathname_individual, pathname, counter);
+ }
+
+ /* Free the copy buffer */
+ free(copy_buf);
+
/* Make sure we can open the file. Use the read and write mode to flush the
* superblock. */
- if((file = H5Fopen(pathname, H5F_ACC_RDWR, fapl)) < 0)
+ if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
@@ -841,7 +883,7 @@ test_family_compat(void)
TEST_ERROR;
/* Open the file again to make sure it isn't corrupted. */
- if((file = H5Fopen(pathname, H5F_ACC_RDWR, fapl)) < 0)
+ if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
@@ -853,8 +895,7 @@ test_family_compat(void)
if(H5Fclose(file) < 0)
TEST_ERROR;
- if(H5Pclose(fapl) < 0)
- TEST_ERROR;
+ h5_cleanup(FILENAME, fapl);
PASSED();
@@ -863,6 +904,7 @@ test_family_compat(void)
error:
H5E_BEGIN_TRY {
H5Fclose(file);
+ H5Pclose(fapl);
} H5E_END_TRY;
return -1;
@@ -979,7 +1021,7 @@ test_multi(void)
if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;