summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2008-06-02 17:47:30 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2008-06-02 17:47:30 (GMT)
commitfc7aea6f7fdbec7e005f90570f75df86ae8b7b0c (patch)
treeb11b6769f2a0320e1020d1fb55d948622cb0ddbb /tools
parent0838a8ddc77b87cabef55596f31ca23b5aeb0192 (diff)
downloadhdf5-fc7aea6f7fdbec7e005f90570f75df86ae8b7b0c.zip
hdf5-fc7aea6f7fdbec7e005f90570f75df86ae8b7b0c.tar.gz
hdf5-fc7aea6f7fdbec7e005f90570f75df86ae8b7b0c.tar.bz2
[svn-r15124] 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).
Diffstat (limited to 'tools')
-rw-r--r--tools/h5diff/h5diffgentest.c21
-rw-r--r--tools/testfiles/h5diff_empty.h5bin0 -> 800 bytes
2 files changed, 16 insertions, 5 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 2fd6fa6..e1a554e 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 )
@@ -71,7 +72,7 @@ const H5L_class_t UD_link_class[1] = {{
*/
/* 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);
@@ -96,7 +97,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);
@@ -122,20 +123,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..3f0d1df
--- /dev/null
+++ b/tools/testfiles/h5diff_empty.h5
Binary files differ