summaryrefslogtreecommitdiffstats
path: root/test/dsets.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-09-24 23:26:23 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-09-24 23:26:23 (GMT)
commit9726d77e95a770111c06e0ec160793185b01dd55 (patch)
tree75ae679b8d0a7934d843e6e0485378caadeca16f /test/dsets.c
parenta52d213b55fffcdb04a56dc6877572ce206a4aa8 (diff)
downloadhdf5-9726d77e95a770111c06e0ec160793185b01dd55.zip
hdf5-9726d77e95a770111c06e0ec160793185b01dd55.tar.gz
hdf5-9726d77e95a770111c06e0ec160793185b01dd55.tar.bz2
[svn-r17526] Description:
Add backward compatibility test to make certain that the 1.8 library handles encountering a file with a fixed array chunk index gracefully. Tested on: FreeBSD/32 6.3 (duty) w/production (too minor to require h5committest)
Diffstat (limited to 'test/dsets.c')
-rw-r--r--test/dsets.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/dsets.c b/test/dsets.c
index 2876dad..cf6322c 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -178,6 +178,11 @@ const char *FILENAME[] = {
#define BYPASS_CHUNK_DIM 500
#define BYPASS_FILL_VALUE 7
+/* Declarations for test_idx_compatible() */
+#define FIXED_IDX_FILE "fixed_idx.h5"
+#define DSET "dset"
+#define DSET_FILTER "dset_filter"
+
/* Shared global arrays */
#define DSET_DIM1 100
#define DSET_DIM2 200
@@ -7242,6 +7247,62 @@ error:
return -1;
} /* end test_chunk_expand() */
+/*-------------------------------------------------------------------------
+ *
+ * test_idx_compatible():
+ * Verify that the 1.8 branch cannot read datasets that use
+ * Fixed Array indexing method.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_idx_compatible(void)
+{
+ hid_t fid; /* File id */
+ hid_t did; /* Dataset id */
+ char *srcdir = HDgetenv("srcdir"); /* where the src code is located */
+ char filename[FILENAME_BUF_SIZE] = ""; /* old test file name */
+
+ /* Output message about test being performed */
+ TESTING("Compatibility for datasets that use Fixed Array indexing\n");
+
+ /* Generate correct name for test file by prepending the source path */
+ if(srcdir && ((HDstrlen(srcdir) + HDstrlen(FIXED_IDX_FILE) + 1) < sizeof(filename))) {
+ HDstrcpy(filename, srcdir);
+ HDstrcat(filename, "/");
+ }
+ HDstrcat(filename, FIXED_IDX_FILE);
+
+ /* Open the file */
+ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Should not able to read the dataset w/o filter that use Fixed Array indexing */
+ H5E_BEGIN_TRY {
+ if((did = H5Dopen2(fid, DSET, H5P_DEFAULT)) != FAIL)
+ TEST_ERROR
+ } H5E_END_TRY;
+
+ /* Should not able to read the dataset w/ filter that use Fixed Array indexing */
+ H5E_BEGIN_TRY {
+ if((did = H5Dopen2(fid, DSET_FILTER, H5P_DEFAULT)) != FAIL)
+ TEST_ERROR
+ } H5E_END_TRY;
+
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return -1;
+} /* test_idx_compatible */
+
/*-------------------------------------------------------------------------
* Function: main
@@ -7366,6 +7427,7 @@ main(void)
nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_idx_compatible() < 0 ? 1 : 0);
if(H5Fclose(file) < 0)
goto error;