diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-12-10 18:06:46 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-12-10 18:06:46 (GMT) |
commit | e475727aeb3c31d7aac754448e85a8e5082b6caa (patch) | |
tree | ac1d4dc131104a465a7e85576a3bcec4dd7483da /test | |
parent | d18280078ef816f72daf35661f9be76654d0a277 (diff) | |
download | hdf5-e475727aeb3c31d7aac754448e85a8e5082b6caa.zip hdf5-e475727aeb3c31d7aac754448e85a8e5082b6caa.tar.gz hdf5-e475727aeb3c31d7aac754448e85a8e5082b6caa.tar.bz2 |
Adding tests for version bounds
Description:
- Added test program, tverbounds18.c, that reads various files
of different layout versions
- Added the data files:
bounds_earliest_latest.h5
bounds_earliest_v18.h5
bounds_latest_latest.h5
bounds_v18_latest.h5
bounds_v18_v18.h5
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 (platypus)
Darwin (osx1010test)
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 2 | ||||
-rw-r--r-- | test/bounds_earliest_latest.h5 | bin | 0 -> 166064 bytes | |||
-rw-r--r-- | test/bounds_earliest_v18.h5 | bin | 0 -> 84016 bytes | |||
-rw-r--r-- | test/bounds_latest_latest.h5 | bin | 0 -> 82048 bytes | |||
-rw-r--r-- | test/bounds_v18_latest.h5 | bin | 0 -> 83095 bytes | |||
-rw-r--r-- | test/bounds_v18_v18.h5 | bin | 0 -> 165143 bytes | |||
-rw-r--r-- | test/testhdf5.c | 1 | ||||
-rw-r--r-- | test/testhdf5.h | 92 | ||||
-rw-r--r-- | test/tverbounds18.c | 284 |
9 files changed, 333 insertions, 46 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 7c55e5b..fd7f9b5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -166,7 +166,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ tgenprop.c th5o.c th5s.c tcoords.c theap.c tid.c titerate.c tmeta.c tmisc.c \ trefer.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c ttst.c tunicode.c \ - tvlstr.c tvltypes.c + tvlstr.c tvltypes.c tverbounds18.c # Temporary files. DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_plugin.sh diff --git a/test/bounds_earliest_latest.h5 b/test/bounds_earliest_latest.h5 Binary files differnew file mode 100644 index 0000000..a05d461 --- /dev/null +++ b/test/bounds_earliest_latest.h5 diff --git a/test/bounds_earliest_v18.h5 b/test/bounds_earliest_v18.h5 Binary files differnew file mode 100644 index 0000000..929c6f8 --- /dev/null +++ b/test/bounds_earliest_v18.h5 diff --git a/test/bounds_latest_latest.h5 b/test/bounds_latest_latest.h5 Binary files differnew file mode 100644 index 0000000..6e8bcad --- /dev/null +++ b/test/bounds_latest_latest.h5 diff --git a/test/bounds_v18_latest.h5 b/test/bounds_v18_latest.h5 Binary files differnew file mode 100644 index 0000000..f401ebb --- /dev/null +++ b/test/bounds_v18_latest.h5 diff --git a/test/bounds_v18_v18.h5 b/test/bounds_v18_v18.h5 Binary files differnew file mode 100644 index 0000000..2f7837b --- /dev/null +++ b/test/bounds_v18_v18.h5 diff --git a/test/testhdf5.c b/test/testhdf5.c index e52d1e8..de1c23d 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -66,6 +66,7 @@ main(int argc, char *argv[]) AddTest("unicode", test_unicode, cleanup_unicode, "UTF-8 Encoding", NULL); AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL); AddTest("misc", test_misc, cleanup_misc, "Miscellaneous", NULL); + AddTest("verbounds18", test_verbounds_18, cleanup_verbounds_18, "Version Bounds", NULL); /* Display testing information */ TestInfo(argv[0]); diff --git a/test/testhdf5.h b/test/testhdf5.h index 2cbe6c6..fd9d68d 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -167,53 +167,55 @@ extern "C" { #endif /* Prototypes for the test routines */ -void test_metadata(void); -void test_checksum(void); -void test_tst(void); -void test_heap(void); -void test_refstr(void); -void test_file(void); -void test_h5o(void); -void test_h5t(void); -void test_h5s(void); -void test_coords(void); -void test_h5d(void); -void test_attr(void); -void test_select(void); -void test_time(void); -void test_reference(void); -void test_vltypes(void); -void test_vlstrings(void); -void test_iterate(void); -void test_array(void); -void test_genprop(void); -void test_configure(void); -void test_misc(void); -void test_ids(void); -void test_skiplist(void); -void test_sohm(void); -void test_unicode(void); +void test_metadata(void); +void test_checksum(void); +void test_tst(void); +void test_heap(void); +void test_refstr(void); +void test_file(void); +void test_h5o(void); +void test_h5t(void); +void test_h5s(void); +void test_coords(void); +void test_h5d(void); +void test_attr(void); +void test_select(void); +void test_time(void); +void test_reference(void); +void test_vltypes(void); +void test_vlstrings(void); +void test_iterate(void); +void test_array(void); +void test_genprop(void); +void test_configure(void); +void test_misc(void); +void test_ids(void); +void test_skiplist(void); +void test_sohm(void); +void test_unicode(void); +void test_verbounds_18(void); /* Prototypes for the cleanup routines */ -void cleanup_metadata(void); -void cleanup_checksum(void); -void cleanup_file(void); -void cleanup_h5o(void); -void cleanup_h5s(void); -void cleanup_coords(void); -void cleanup_attr(void); -void cleanup_select(void); -void cleanup_time(void); -void cleanup_reference(void); -void cleanup_vltypes(void); -void cleanup_vlstrings(void); -void cleanup_iterate(void); -void cleanup_array(void); -void cleanup_genprop(void); -void cleanup_configure(void); -void cleanup_sohm(void); -void cleanup_misc(void); -void cleanup_unicode(void); +void cleanup_metadata(void); +void cleanup_checksum(void); +void cleanup_file(void); +void cleanup_h5o(void); +void cleanup_h5s(void); +void cleanup_coords(void); +void cleanup_attr(void); +void cleanup_select(void); +void cleanup_time(void); +void cleanup_reference(void); +void cleanup_vltypes(void); +void cleanup_vlstrings(void); +void cleanup_iterate(void); +void cleanup_array(void); +void cleanup_genprop(void); +void cleanup_configure(void); +void cleanup_sohm(void); +void cleanup_misc(void); +void cleanup_unicode(void); +void cleanup_verbounds_18(void); #ifdef __cplusplus } diff --git a/test/tverbounds18.c b/test/tverbounds18.c new file mode 100644 index 0000000..563d084 --- /dev/null +++ b/test/tverbounds18.c @@ -0,0 +1,284 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*********************************************************** +* +* Test program: tverbounds18 +* +* Test 1.8 compatibility with version bounds +* +* Description +* =========== +* This file tests the compatibility in the files generated +* by gen_bounds.c in HDF5 1.10.2: +* - bounds_earliest_latest.h5 +* - bounds_earliest_v18.h5 +* - bounds_latest_latest.h5 +* - bounds_v18_latest.h5 +* - bounds_v18_v18.h5 +* +* Oct 30, 2017 +* +*************************************************************/ + + /* #include "hdf5.h" + */ +#include "h5test.h" +#include "H5srcdir.h" +#include "testhdf5.h" + +/*********************************************************************** + * test_earliest_latest() creates file "bounds_earliest_latest.h5" + * + * Description: + * This test shows that the 1.8 library is able to open a chunked dataset + * with layout version 3 in a file with superblock version 0 and + * earliest and latest bounds. However, it cannot open the chunked + * dataset with layout version 4 in the same file. + * + ***********************************************************************/ +#define FILENAME_E_L "bounds_earliest_latest.h5" +static void test_earliest_latest(void) +{ + hid_t fid = FAIL; /* File ID */ + hid_t dset = FAIL; /* Dataset ID */ + herr_t ret; /* Return value */ + + /* Test file name must have correct path when srcdir is used */ + const char *testfile = H5_get_srcdir_filename(FILENAME_E_L); + + /* Open file */ + fid = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* + * Open the chunked dataset with layout version 3 + */ + + /* Open the dataset */ + dset = H5Dopen(fid, "DS_chunked_layout_3", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen"); + + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* + * Open the chunked dataset with layout version 4. This should fail + * with HDF5 1.8. + */ + + /* Open the dataset */ + H5E_BEGIN_TRY { + dset = H5Dopen(fid, "DS_chunked_layout_4", H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(dset, FAIL, "H5Dopen"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); +} + +/*********************************************************************** + * test_earliest_v18() creates file "bounds_earliest_v18.h5" + * + * Description: + * This test shows that the 1.8 library is able to open a chunked dataset + * with layout version 3 in a file with superblock version 0 and + * earliest and version 1.8 bounds. + * + ***********************************************************************/ +#define FILENAME_E_18 "bounds_earliest_v18.h5" + +static void test_earliest_v18(void) +{ + hid_t fid = FAIL; /* File ID */ + hid_t dset = FAIL; /* Dataset ID */ + herr_t ret; /* Return value */ + + /* Test file name must have correct path when srcdir is used */ + const char *testfile = H5_get_srcdir_filename(FILENAME_E_18); + + /* Open file */ + fid = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* + * Open the chunked dataset with layout version 3 + */ + + /* Open the dataset */ + dset = H5Dopen(fid, "DS_chunked_layout_3", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen"); + + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); +} + +/*********************************************************************** + * test_latest_latest() creates file "bounds_latest_latest.h5" + * + * Description: + * This test shows that the 1.8 library is able to open a file with + * superblock version 3. + * + ***********************************************************************/ +#define FILENAME_L_L "bounds_latest_latest.h5" + +static void test_latest_latest(void) +{ + hid_t fid = FAIL; /* File ID */ + + /* Test file name must have correct path when srcdir is used */ + const char *testfile = H5_get_srcdir_filename(FILENAME_L_L); + + /* Opening the file of latest version bounds should fail with HDF5 1.8. */ + H5E_BEGIN_TRY { + fid = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(fid, FAIL, "H5Fopen file with latest version bounds"); +} + +/*********************************************************************** + * test_v18_latest() creates file "bounds_v18_latest.h5" + * + * Description: + * This test shows that the 1.8 library is able to open a chunked dataset + * with layout version 3 in a file with superblock version 2. + * + ***********************************************************************/ +#define FILENAME_18_L "bounds_v18_latest.h5" + +static void test_v18_latest(void) +{ + hid_t fid = FAIL; /* File ID */ + hid_t dset = FAIL; /* Dataset ID */ + herr_t ret; /* Return value */ + + /* Test file name must have correct path when srcdir is used */ + const char *testfile = H5_get_srcdir_filename(FILENAME_18_L); + + /* Open file */ + fid = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* + * Open the chunked dataset with layout version 3 + */ + + /* Open the dataset */ + dset = H5Dopen(fid, "DS_chunked_layout_3", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen"); + + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); +} + +/*********************************************************************** + * test_v18_v18() creates file "bounds_v18_v18.h5" + * + * Description: + * This test shows that the 1.8 library is able to open a chunked dataset + * with layout version 3 in a file with superblock version 2 and + * version 1.8 bounds. However, it cannot open the chunked + * dataset with layout version 4 in the same file. + * + ***********************************************************************/ +#define FILENAME_18_18 "bounds_v18_v18.h5" + +static void test_v18_v18(void) +{ + hid_t fid = FAIL; /* File ID */ + hid_t dset = FAIL; /* Dataset ID */ + herr_t ret; /* Return value */ + + /* Test file name must have correct path when srcdir is used */ + const char *testfile = H5_get_srcdir_filename(FILENAME_18_18); + + /* Open file */ + fid = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* + * Open the chunked dataset with layout version 3 + */ + + /* Open the dataset */ + dset = H5Dopen(fid, "DS_chunked_layout_3", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen"); + + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* + * Open the chunked dataset with layout version 4. This should fail + * with HDF5 1.8. + */ + + /* Open the dataset */ + H5E_BEGIN_TRY { + dset = H5Dopen(fid, "DS_chunked_layout_4", H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(dset, FAIL, "H5Dopen"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); +} + +/************************************************************************* +** +** test_libver_bounds_withv18(): +** Main routine to test library version bounds with HDF5 1.8 library. +** +*************************************************************************/ +void test_verbounds_18(void) +{ + /* Output message about test being performed */ + MESSAGE(5, ("Testing Compatibility of Version Bounds with 1.8\n")); + + /* Test with file bounds_earliest_latest.h5 */ + test_earliest_latest(); + + /* Test with file bounds_earliest_v18.h5 */ + test_earliest_v18(); + + /* Test with file bounds_latest_latest.h5 */ + test_latest_latest(); + + /* Test with file bounds_v18_latest.h5 */ + test_v18_latest(); + + /* Test with file bounds_v18_v18.h5 */ + test_v18_v18(); +} + +/*------------------------------------------------------------------------- + * Function: cleanup_verbounds_18 + * + * Purpose: Cleanup temporary test files + * + * Return: none + * + *------------------------------------------------------------------------- + */ +void cleanup_verbounds_18(void) +{ +} |