summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/h5copy/testh5copy.sh73
-rw-r--r--tools/h5diff/h5diff_common.c5
-rw-r--r--tools/h5diff/h5diff_main.c33
-rw-r--r--tools/lib/h5diff.c5
4 files changed, 94 insertions, 22 deletions
diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh
index 0acc4df..c1d0309 100644
--- a/tools/h5copy/testh5copy.sh
+++ b/tools/h5copy/testh5copy.sh
@@ -115,10 +115,53 @@ TOOLTEST()
fi
if [ $runh5diff != no ]; then
- H5DIFFTEST $inputfile $outputfile
+ H5DIFFTEST $inputfile $outputfile $7 $9
fi
}
+
+TOOLTEST_FAIL()
+{
+ runh5diff=yes
+ if [ "$1" = -i ]; then
+ inputfile=$2
+ else
+ runh5diff=no
+ fi
+ if [ "$3" = -o ]; then
+ outputfile=$4
+ else
+ runh5diff=no
+ fi
+
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN $@
+ ) > output.out
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat output.out
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f output.out
+ fi
+ fi
+
+ if [ $runh5diff != no ]; then
+ H5DIFFTEST_FAIL $inputfile $outputfile $7 $9
+ fi
+}
+
+
# Call the h5diff tool
#
H5DIFFTEST()
@@ -138,6 +181,26 @@ H5DIFFTEST()
fi
}
+# Call the h5diff tool with a call that is expected to fail
+#
+H5DIFFTEST_FAIL()
+{
+ VERIFY $@
+ if [ "`uname -s`" = "TFLOPS O/S" ]; then
+ $RUNSERIAL $H5DIFF_BIN -q $@
+ else
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
+ fi
+ RET=$?
+
+ if [ $RET != 1 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+}
+
# Call the h5ls tool to verify the correct output data in the destination file
#
H5LSTEST()
@@ -215,17 +278,17 @@ COPYOBJECTS()
TOOLTEST -i $TESTFILE -o $FILEOUT -v -s /grp_dsets/simple -d /grp_dsets/simple_group
echo "Test copying & renaming group"
- TOOLTEST -i $TESTFILE -o $FILEOUT -v -s grp_dsets -d grp_rename
+ TOOLTEST_FAIL -i $TESTFILE -o $FILEOUT -v -s grp_dsets -d grp_rename
echo "Test copying 'full' group hierarchy into group in destination file"
- TOOLTEST -i $TESTFILE -o $FILEOUT -v -s grp_dsets -d /grp_rename/grp_dsets
+ TOOLTEST_FAIL -i $TESTFILE -o $FILEOUT -v -s grp_dsets -d /grp_rename/grp_dsets
echo "Test copying objects into group hier. that doesn't exist yet in destination file"
TOOLTEST -i $TESTFILE -o $FILEOUT -vp -s simple -d /A/B1/simple
TOOLTEST -i $TESTFILE -o $FILEOUT -vp -s simple -d /A/B2/simple2
TOOLTEST -i $TESTFILE -o $FILEOUT -vp -s /grp_dsets/simple -d /C/D/simple
- TOOLTEST -i $TESTFILE -o $FILEOUT -vp -s /grp_dsets -d /E/F/grp_dsets
- TOOLTEST -i $TESTFILE -o $FILEOUT -vp -s /grp_nested -d /G/H/grp_nested
+ TOOLTEST_FAIL -i $TESTFILE -o $FILEOUT -vp -s /grp_dsets -d /E/F/grp_dsets
+ TOOLTEST_FAIL -i $TESTFILE -o $FILEOUT -vp -s /grp_nested -d /G/H/grp_nested
# Verify that the file created above is correct
H5LSTEST $FILEOUT
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index eda96ae..5a59215 100644
--- a/tools/h5diff/h5diff_common.c
+++ b/tools/h5diff/h5diff_common.c
@@ -67,6 +67,9 @@ void parse_command_line(int argc,
/* process the command-line */
memset(options, 0, sizeof (diff_opt_t));
+ /* assume equal contents initially */
+ options->contents = 1;
+
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
{
@@ -160,6 +163,7 @@ void parse_command_line(int argc,
}
+
/*-------------------------------------------------------------------------
* Function: print_info
*
@@ -320,7 +324,6 @@ void usage(void)
printf(" -v, --verbose Verbose mode. Print differences, list of objects\n");
printf(" -q, --quiet Quiet mode. Do not do output\n");
-
printf(" -n C, --count=C Print differences up to C number\n");
printf(" -d D, --delta=D Print difference when greater than limit D\n");
printf(" -p R, --relative=R Print difference when greater than relative limit R\n");
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index f79099e..822d59c 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -13,10 +13,12 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "h5diff.h"
#include <stdlib.h>
#include <assert.h>
+#include <memory.h>
+#include "h5diff.h"
#include "h5diff_common.h"
+#include "h5tools_utils.h"
/*-------------------------------------------------------------------------
* Function: main
@@ -62,12 +64,6 @@
* November 19, 2007
* adopted the syntax h5diff [OPTIONS] file1 file2 [obj1[obj2]]
*
- * Aug 2008
- * Added a "contents" mode check.
- * If this mode is present, objects in both files must match (must be exactly the same)
- * If this does not happen, the tool returns an error code of 1
- * (instead of the success code of 0)
- *
*-------------------------------------------------------------------------
*/
@@ -75,15 +71,25 @@
int main(int argc, const char *argv[])
{
int ret;
- char *fname1 = NULL;
- char *fname2 = NULL;
- char *objname1 = NULL;
- char *objname2 = NULL;
+ const char *fname1 = NULL;
+ const char *fname2 = NULL;
+ const char *objname1 = NULL;
+ const char *objname2 = NULL;
hsize_t nfound=0;
diff_opt_t options;
+ /*-------------------------------------------------------------------------
+ * process the command-line
+ *-------------------------------------------------------------------------
+ */
+
parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+ /*-------------------------------------------------------------------------
+ * do the diff
+ *-------------------------------------------------------------------------
+ */
+
nfound = h5diff(fname1,fname2,objname1,objname2,&options);
print_info(&options);
@@ -96,11 +102,14 @@ int main(int argc, const char *argv[])
ret = (nfound == 0 ? 0 : 1 );
+ /* if graph difference return 1 for differences */
if ( options.contents == 0 )
ret = 1;
- if(options.err_stat)
+ /* and return 2 for error */
+ if (options.err_stat)
ret = 2;
+
return ret;
}
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index df479de..8876a24 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -454,10 +454,7 @@ hsize_t diff_match(hid_t file1_id,
* in file1 must be the same as in file2
*-------------------------------------------------------------------------
*/
-
- /* assume equal contents initially */
- options->contents = 1;
-
+
/* number of different objects */
if ( info1->nused != info2->nused )
{