summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2008-06-04 17:12:31 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2008-06-04 17:12:31 (GMT)
commit125b83fc5f3873f8f2d9242ae6b5db29e36b2763 (patch)
treed531639fd9e0af7b45a66ecba97e75fc198de7ba
parenta3e256c7b6f091db57d206c6a346aa64b1e7f0c0 (diff)
downloadhdf5-125b83fc5f3873f8f2d9242ae6b5db29e36b2763.zip
hdf5-125b83fc5f3873f8f2d9242ae6b5db29e36b2763.tar.gz
hdf5-125b83fc5f3873f8f2d9242ae6b5db29e36b2763.tar.bz2
[svn-r15135] Purpose:
bug fixes. Description: Added code to create an empty hdf5 (named h5diff_empty.h5) in order to test if h5diff compares correctly an empty hdf5 vs. a non-empty one. Tested: Tested in kagiso of h5diffgentest itself. Verified by h5dump that h5diff_empty.h5 was indeed empty. Then "h5diff h5diff_empty.h5 h5diff_basic1.h5" returned 0 (should have returned non-zero).
-rw-r--r--MANIFEST1
-rw-r--r--tools/h5diff/h5diffgentest.c21
-rw-r--r--tools/testfiles/h5diff_empty.h5bin0 -> 976 bytes
3 files changed, 17 insertions, 5 deletions
diff --git a/MANIFEST b/MANIFEST
index 2bbb5fb..d71ffcb 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1901,6 +1901,7 @@
./tools/testfiles/h5diff_dtypes.h5
./tools/testfiles/h5diff_dset1.h5
./tools/testfiles/h5diff_dset2.h5
+./tools/testfiles/h5diff_empty.h5
./tools/testfiles/h5diff_hyper1.h5
./tools/testfiles/h5diff_attr1.h5
./tools/testfiles/h5diff_hyper2.h5
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 9c4d5a5..398c552 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -40,6 +40,7 @@
#define FILE8 "h5diff_dset2.h5"
#define FILE9 "h5diff_hyper1.h5"
#define FILE10 "h5diff_hyper2.h5"
+#define FILE11 "h5diff_empty.h5"
#define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */
#define STR_SIZE 3
#define GBLL ((unsigned long_long) 1024 * 1024 *1024 )
@@ -52,7 +53,7 @@
*/
/* tests called in main() */
-static int test_basic(const char *fname1,const char *fname2);
+static int test_basic(const char *fname1, const char *fname2, const char *fname3);
static int test_types(const char *fname);
static int test_datatypes(const char *fname);
static int test_attributes(const char *fname,int make_diffs);
@@ -77,7 +78,7 @@ static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t
int main(void)
{
- if ( test_basic (FILE1,FILE2) < 0 )
+ if (test_basic(FILE1, FILE2, FILE11) < 0 )
goto out;
test_types (FILE3);
@@ -105,20 +106,30 @@ out:
/*-------------------------------------------------------------------------
* Function: test_basic
*
- * Purpose: basic tests
+ * Purpose: Create basic test files, first two contains different data, the
+ * third one is just an empty file.
*
*-------------------------------------------------------------------------
*/
static
-int test_basic(const char *fname1,
- const char *fname2)
+int test_basic(const char *fname1, const char *fname2, const char *fname3)
{
hid_t fid1, fid2;
hid_t gid1, gid2, gid3;
hsize_t dims1[1] = { 6 };
hsize_t dims2[2] = { 3,2 };
+ /* create the empty file */
+ if ((fid1=H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0){
+ fprintf(stderr, "empty file (%s) creation failed.\n", fname3);
+ goto out;
+ }
+ if (H5Fclose(fid1) < 0){
+ fprintf(stderr, "empty file (%s) close failed.\n", fname3);
+ goto out;
+ }
+
/*-------------------------------------------------------------------------
* create two files
*-------------------------------------------------------------------------
diff --git a/tools/testfiles/h5diff_empty.h5 b/tools/testfiles/h5diff_empty.h5
new file mode 100644
index 0000000..c11879d
--- /dev/null
+++ b/tools/testfiles/h5diff_empty.h5
Binary files differ