From 52d87caef30f70ffd798698158b83bf0c2dcdbba Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Thu, 18 Feb 2010 21:39:22 -0500 Subject: [svn-r18279] Purpose: Work for bugzilla 1754: h5diff: support comparing through links. Description: merged from hdf5 trunk (18164, 18165, 18166, 18167, 18170, 18266, 18273) Tested: h5committest (jam, amani and linew) --- MANIFEST | 124 ++- release_docs/RELEASE.txt | 6 + tools/h5diff/h5diff_common.c | 115 ++- tools/h5diff/h5diff_main.c | 1 + tools/h5diff/h5diffgentest.c | 943 +++++++++++++++++++++- tools/h5diff/testfiles/h5diff_10.txt | 98 ++- tools/h5diff/testfiles/h5diff_100.txt | 1 + tools/h5diff/testfiles/h5diff_101.txt | 1 + tools/h5diff/testfiles/h5diff_102.txt | 1 + tools/h5diff/testfiles/h5diff_11.txt | 1 + tools/h5diff/testfiles/h5diff_12.txt | 1 + tools/h5diff/testfiles/h5diff_13.txt | 1 + tools/h5diff/testfiles/h5diff_14.txt | 1 + tools/h5diff/testfiles/h5diff_15.txt | 1 + tools/h5diff/testfiles/h5diff_16_1.txt | 1 + tools/h5diff/testfiles/h5diff_16_2.txt | 1 + tools/h5diff/testfiles/h5diff_16_3.txt | 1 + tools/h5diff/testfiles/h5diff_17.txt | 1 + tools/h5diff/testfiles/h5diff_171.txt | 1 + tools/h5diff/testfiles/h5diff_172.txt | 1 + tools/h5diff/testfiles/h5diff_18.txt | 1 + tools/h5diff/testfiles/h5diff_18_1.txt | 2 + tools/h5diff/testfiles/h5diff_20.txt | 1 + tools/h5diff/testfiles/h5diff_200.txt | 1 + tools/h5diff/testfiles/h5diff_201.txt | 1 + tools/h5diff/testfiles/h5diff_202.txt | 1 + tools/h5diff/testfiles/h5diff_203.txt | 1 + tools/h5diff/testfiles/h5diff_204.txt | 1 + tools/h5diff/testfiles/h5diff_205.txt | 1 + tools/h5diff/testfiles/h5diff_206.txt | 1 + tools/h5diff/testfiles/h5diff_207.txt | 1 + tools/h5diff/testfiles/h5diff_21.txt | 1 + tools/h5diff/testfiles/h5diff_22.txt | 1 + tools/h5diff/testfiles/h5diff_23.txt | 1 + tools/h5diff/testfiles/h5diff_24.txt | 1 + tools/h5diff/testfiles/h5diff_25.txt | 1 + tools/h5diff/testfiles/h5diff_26.txt | 1 + tools/h5diff/testfiles/h5diff_27.txt | 1 + tools/h5diff/testfiles/h5diff_28.txt | 1 + tools/h5diff/testfiles/h5diff_300.txt | 1 + tools/h5diff/testfiles/h5diff_400.txt | 48 ++ tools/h5diff/testfiles/h5diff_401.txt | 13 + tools/h5diff/testfiles/h5diff_402.txt | 13 + tools/h5diff/testfiles/h5diff_403.txt | 13 + tools/h5diff/testfiles/h5diff_404.txt | 34 + tools/h5diff/testfiles/h5diff_405.txt | 13 + tools/h5diff/testfiles/h5diff_406.txt | 13 + tools/h5diff/testfiles/h5diff_407.txt | 13 + tools/h5diff/testfiles/h5diff_408.txt | 13 + tools/h5diff/testfiles/h5diff_409.txt | 13 + tools/h5diff/testfiles/h5diff_410.txt | 86 ++ tools/h5diff/testfiles/h5diff_411.txt | 13 + tools/h5diff/testfiles/h5diff_412.txt | 13 + tools/h5diff/testfiles/h5diff_413.txt | 13 + tools/h5diff/testfiles/h5diff_414.txt | 3 + tools/h5diff/testfiles/h5diff_415.txt | 3 + tools/h5diff/testfiles/h5diff_416.txt | 3 + tools/h5diff/testfiles/h5diff_417.txt | 3 + tools/h5diff/testfiles/h5diff_418.txt | 3 + tools/h5diff/testfiles/h5diff_419.txt | 3 + tools/h5diff/testfiles/h5diff_420.txt | 3 + tools/h5diff/testfiles/h5diff_421.txt | 3 + tools/h5diff/testfiles/h5diff_422.txt | 3 + tools/h5diff/testfiles/h5diff_423.txt | 13 + tools/h5diff/testfiles/h5diff_424.txt | 13 + tools/h5diff/testfiles/h5diff_425.txt | 13 + tools/h5diff/testfiles/h5diff_450.txt | 35 + tools/h5diff/testfiles/h5diff_451.txt | 28 + tools/h5diff/testfiles/h5diff_452.txt | 2 + tools/h5diff/testfiles/h5diff_453.txt | 47 ++ tools/h5diff/testfiles/h5diff_454.txt | 2 + tools/h5diff/testfiles/h5diff_455.txt | 2 + tools/h5diff/testfiles/h5diff_456.txt | 32 + tools/h5diff/testfiles/h5diff_457.txt | 2 + tools/h5diff/testfiles/h5diff_458.txt | 2 + tools/h5diff/testfiles/h5diff_459.txt | 2 + tools/h5diff/testfiles/h5diff_50.txt | 1 + tools/h5diff/testfiles/h5diff_51.txt | 1 + tools/h5diff/testfiles/h5diff_52.txt | 1 + tools/h5diff/testfiles/h5diff_53.txt | 1 + tools/h5diff/testfiles/h5diff_54.txt | 1 + tools/h5diff/testfiles/h5diff_55.txt | 1 + tools/h5diff/testfiles/h5diff_56.txt | 1 + tools/h5diff/testfiles/h5diff_57.txt | 1 + tools/h5diff/testfiles/h5diff_58.txt | 1 + tools/h5diff/testfiles/h5diff_600.txt | 98 ++- tools/h5diff/testfiles/h5diff_603.txt | 98 ++- tools/h5diff/testfiles/h5diff_604.txt | 1 + tools/h5diff/testfiles/h5diff_605.txt | 1 + tools/h5diff/testfiles/h5diff_606.txt | 98 ++- tools/h5diff/testfiles/h5diff_607.txt | 1 + tools/h5diff/testfiles/h5diff_608.txt | 1 + tools/h5diff/testfiles/h5diff_609.txt | 1 + tools/h5diff/testfiles/h5diff_610.txt | 1 + tools/h5diff/testfiles/h5diff_612.txt | 98 ++- tools/h5diff/testfiles/h5diff_613.txt | 1 + tools/h5diff/testfiles/h5diff_614.txt | 1 + tools/h5diff/testfiles/h5diff_615.txt | 98 ++- tools/h5diff/testfiles/h5diff_616.txt | 1 + tools/h5diff/testfiles/h5diff_617.txt | 1 + tools/h5diff/testfiles/h5diff_618.txt | 1 + tools/h5diff/testfiles/h5diff_619.txt | 1 + tools/h5diff/testfiles/h5diff_621.txt | 98 ++- tools/h5diff/testfiles/h5diff_622.txt | 98 ++- tools/h5diff/testfiles/h5diff_623.txt | 98 ++- tools/h5diff/testfiles/h5diff_624.txt | 98 ++- tools/h5diff/testfiles/h5diff_625.txt | 1 + tools/h5diff/testfiles/h5diff_626.txt | 1 + tools/h5diff/testfiles/h5diff_627.txt | 1 + tools/h5diff/testfiles/h5diff_628.txt | 1 + tools/h5diff/testfiles/h5diff_629.txt | 1 + tools/h5diff/testfiles/h5diff_70.txt | 1 + tools/h5diff/testfiles/h5diff_80.txt | 1 + tools/h5diff/testfiles/h5diff_90.txt | 1 + tools/h5diff/testfiles/h5diff_danglelinks1.h5 | Bin 0 -> 5012 bytes tools/h5diff/testfiles/h5diff_danglelinks2.h5 | Bin 0 -> 5012 bytes tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 | Bin 0 -> 1072 bytes tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 | Bin 0 -> 4640 bytes tools/h5diff/testfiles/h5diff_extlink_src.h5 | Bin 0 -> 1256 bytes tools/h5diff/testfiles/h5diff_extlink_trg.h5 | Bin 0 -> 6056 bytes tools/h5diff/testfiles/h5diff_linked_softlink.h5 | Bin 0 -> 8144 bytes tools/h5diff/testfiles/h5diff_softlinks.h5 | Bin 0 -> 5744 bytes tools/h5diff/testh5diff.sh | 306 ++++--- tools/lib/h5diff.c | 835 +++++++++++++++---- tools/lib/h5diff.h | 2 + 125 files changed, 3252 insertions(+), 655 deletions(-) create mode 100644 tools/h5diff/testfiles/h5diff_18_1.txt create mode 100644 tools/h5diff/testfiles/h5diff_400.txt create mode 100644 tools/h5diff/testfiles/h5diff_401.txt create mode 100644 tools/h5diff/testfiles/h5diff_402.txt create mode 100644 tools/h5diff/testfiles/h5diff_403.txt create mode 100644 tools/h5diff/testfiles/h5diff_404.txt create mode 100644 tools/h5diff/testfiles/h5diff_405.txt create mode 100644 tools/h5diff/testfiles/h5diff_406.txt create mode 100644 tools/h5diff/testfiles/h5diff_407.txt create mode 100644 tools/h5diff/testfiles/h5diff_408.txt create mode 100644 tools/h5diff/testfiles/h5diff_409.txt create mode 100644 tools/h5diff/testfiles/h5diff_410.txt create mode 100644 tools/h5diff/testfiles/h5diff_411.txt create mode 100644 tools/h5diff/testfiles/h5diff_412.txt create mode 100644 tools/h5diff/testfiles/h5diff_413.txt create mode 100644 tools/h5diff/testfiles/h5diff_414.txt create mode 100644 tools/h5diff/testfiles/h5diff_415.txt create mode 100644 tools/h5diff/testfiles/h5diff_416.txt create mode 100644 tools/h5diff/testfiles/h5diff_417.txt create mode 100644 tools/h5diff/testfiles/h5diff_418.txt create mode 100644 tools/h5diff/testfiles/h5diff_419.txt create mode 100644 tools/h5diff/testfiles/h5diff_420.txt create mode 100644 tools/h5diff/testfiles/h5diff_421.txt create mode 100644 tools/h5diff/testfiles/h5diff_422.txt create mode 100644 tools/h5diff/testfiles/h5diff_423.txt create mode 100644 tools/h5diff/testfiles/h5diff_424.txt create mode 100644 tools/h5diff/testfiles/h5diff_425.txt create mode 100644 tools/h5diff/testfiles/h5diff_450.txt create mode 100644 tools/h5diff/testfiles/h5diff_451.txt create mode 100644 tools/h5diff/testfiles/h5diff_452.txt create mode 100644 tools/h5diff/testfiles/h5diff_453.txt create mode 100644 tools/h5diff/testfiles/h5diff_454.txt create mode 100644 tools/h5diff/testfiles/h5diff_455.txt create mode 100644 tools/h5diff/testfiles/h5diff_456.txt create mode 100644 tools/h5diff/testfiles/h5diff_457.txt create mode 100644 tools/h5diff/testfiles/h5diff_458.txt create mode 100644 tools/h5diff/testfiles/h5diff_459.txt create mode 100644 tools/h5diff/testfiles/h5diff_danglelinks1.h5 create mode 100644 tools/h5diff/testfiles/h5diff_danglelinks2.h5 create mode 100644 tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 create mode 100644 tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 create mode 100644 tools/h5diff/testfiles/h5diff_extlink_src.h5 create mode 100644 tools/h5diff/testfiles/h5diff_extlink_trg.h5 create mode 100644 tools/h5diff/testfiles/h5diff_linked_softlink.h5 create mode 100644 tools/h5diff/testfiles/h5diff_softlinks.h5 diff --git a/MANIFEST b/MANIFEST index 635c6c5..2b7a42e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1409,8 +1409,21 @@ ./tools/testfiles/torderattr1.h5.xml - #test files for h5diff +./tools/h5diff/testfiles/h5diff_10.txt +./tools/h5diff/testfiles/h5diff_11.txt +./tools/h5diff/testfiles/h5diff_12.txt +./tools/h5diff/testfiles/h5diff_13.txt +./tools/h5diff/testfiles/h5diff_14.txt +./tools/h5diff/testfiles/h5diff_15.txt +./tools/h5diff/testfiles/h5diff_16_1.txt +./tools/h5diff/testfiles/h5diff_16_2.txt +./tools/h5diff/testfiles/h5diff_16_3.txt +./tools/h5diff/testfiles/h5diff_17.txt +./tools/h5diff/testfiles/h5diff_171.txt +./tools/h5diff/testfiles/h5diff_172.txt +./tools/h5diff/testfiles/h5diff_18.txt +./tools/h5diff/testfiles/h5diff_18_1.txt ./tools/h5diff/testfiles/h5diff_20.txt ./tools/h5diff/testfiles/h5diff_21.txt ./tools/h5diff/testfiles/h5diff_22.txt @@ -1420,7 +1433,15 @@ ./tools/h5diff/testfiles/h5diff_26.txt ./tools/h5diff/testfiles/h5diff_27.txt ./tools/h5diff/testfiles/h5diff_28.txt -./tools/h5diff/testfiles/h5diff_basic1.h5 +./tools/h5diff/testfiles/h5diff_50.txt +./tools/h5diff/testfiles/h5diff_51.txt +./tools/h5diff/testfiles/h5diff_52.txt +./tools/h5diff/testfiles/h5diff_53.txt +./tools/h5diff/testfiles/h5diff_54.txt +./tools/h5diff/testfiles/h5diff_55.txt +./tools/h5diff/testfiles/h5diff_56.txt +./tools/h5diff/testfiles/h5diff_57.txt +./tools/h5diff/testfiles/h5diff_58.txt ./tools/h5diff/testfiles/h5diff_600.txt ./tools/h5diff/testfiles/h5diff_603.txt ./tools/h5diff/testfiles/h5diff_604.txt @@ -1429,11 +1450,6 @@ ./tools/h5diff/testfiles/h5diff_607.txt ./tools/h5diff/testfiles/h5diff_608.txt ./tools/h5diff/testfiles/h5diff_609.txt -./tools/h5diff/testfiles/h5diff_dset2.h5 -./tools/h5diff/testfiles/h5diff_70.txt -./tools/h5diff/testfiles/h5diff_attr2.h5 -./tools/h5diff/testfiles/h5diff_types.h5 -./tools/h5diff/testfiles/h5diff_dtypes.h5 ./tools/h5diff/testfiles/h5diff_610.txt ./tools/h5diff/testfiles/h5diff_612.txt ./tools/h5diff/testfiles/h5diff_613.txt @@ -1441,20 +1457,9 @@ ./tools/h5diff/testfiles/h5diff_615.txt ./tools/h5diff/testfiles/h5diff_616.txt ./tools/h5diff/testfiles/h5diff_617.txt -./tools/h5diff/testfiles/h5diff_dset1.h5 ./tools/h5diff/testfiles/h5diff_618.txt ./tools/h5diff/testfiles/h5diff_619.txt -./tools/h5diff/testfiles/h5diff_80.txt -./tools/h5diff/testfiles/h5diff_attr1.h5 -./tools/h5diff/testfiles/h5diff_empty.h5 -./tools/h5diff/testfiles/h5diff_100.txt -./tools/h5diff/testfiles/h5diff_101.txt -./tools/h5diff/testfiles/h5diff_102.txt -./tools/h5diff/testfiles/h5diff_hyper2.h5 -./tools/h5diff/testfiles/h5diff_16_1.txt -./tools/h5diff/testfiles/h5diff_16_2.txt ./tools/h5diff/testfiles/h5diff_621.txt -./tools/h5diff/testfiles/h5diff_16_3.txt ./tools/h5diff/testfiles/h5diff_622.txt ./tools/h5diff/testfiles/h5diff_623.txt ./tools/h5diff/testfiles/h5diff_624.txt @@ -1462,29 +1467,13 @@ ./tools/h5diff/testfiles/h5diff_626.txt ./tools/h5diff/testfiles/h5diff_627.txt ./tools/h5diff/testfiles/h5diff_628.txt -./tools/h5diff/testfiles/h5diff_10.txt ./tools/h5diff/testfiles/h5diff_629.txt -./tools/h5diff/testfiles/h5diff_11.txt -./tools/h5diff/testfiles/h5diff_12.txt -./tools/h5diff/testfiles/h5diff_13.txt -./tools/h5diff/testfiles/h5diff_50.txt -./tools/h5diff/testfiles/h5diff_14.txt -./tools/h5diff/testfiles/h5diff_51.txt -./tools/h5diff/testfiles/h5diff_15.txt -./tools/h5diff/testfiles/h5diff_52.txt -./tools/h5diff/testfiles/h5diff_53.txt -./tools/h5diff/testfiles/h5diff_17.txt -./tools/h5diff/testfiles/h5diff_171.txt -./tools/h5diff/testfiles/h5diff_172.txt -./tools/h5diff/testfiles/h5diff_54.txt -./tools/h5diff/testfiles/h5diff_18.txt +./tools/h5diff/testfiles/h5diff_70.txt +./tools/h5diff/testfiles/h5diff_80.txt ./tools/h5diff/testfiles/h5diff_90.txt -./tools/h5diff/testfiles/h5diff_55.txt -./tools/h5diff/testfiles/h5diff_56.txt -./tools/h5diff/testfiles/h5diff_57.txt -./tools/h5diff/testfiles/h5diff_58.txt -./tools/h5diff/testfiles/h5diff_basic2.h5 -./tools/h5diff/testfiles/h5diff_hyper1.h5 +./tools/h5diff/testfiles/h5diff_100.txt +./tools/h5diff/testfiles/h5diff_101.txt +./tools/h5diff/testfiles/h5diff_102.txt ./tools/h5diff/testfiles/h5diff_200.txt ./tools/h5diff/testfiles/h5diff_201.txt ./tools/h5diff/testfiles/h5diff_202.txt @@ -1494,7 +1483,64 @@ ./tools/h5diff/testfiles/h5diff_206.txt ./tools/h5diff/testfiles/h5diff_207.txt ./tools/h5diff/testfiles/h5diff_300.txt +./tools/h5diff/testfiles/h5diff_400.txt +./tools/h5diff/testfiles/h5diff_401.txt +./tools/h5diff/testfiles/h5diff_402.txt +./tools/h5diff/testfiles/h5diff_403.txt +./tools/h5diff/testfiles/h5diff_404.txt +./tools/h5diff/testfiles/h5diff_405.txt +./tools/h5diff/testfiles/h5diff_406.txt +./tools/h5diff/testfiles/h5diff_407.txt +./tools/h5diff/testfiles/h5diff_408.txt +./tools/h5diff/testfiles/h5diff_409.txt +./tools/h5diff/testfiles/h5diff_410.txt +./tools/h5diff/testfiles/h5diff_411.txt +./tools/h5diff/testfiles/h5diff_412.txt +./tools/h5diff/testfiles/h5diff_413.txt +./tools/h5diff/testfiles/h5diff_414.txt +./tools/h5diff/testfiles/h5diff_415.txt +./tools/h5diff/testfiles/h5diff_416.txt +./tools/h5diff/testfiles/h5diff_417.txt +./tools/h5diff/testfiles/h5diff_418.txt +./tools/h5diff/testfiles/h5diff_419.txt +./tools/h5diff/testfiles/h5diff_420.txt +./tools/h5diff/testfiles/h5diff_421.txt +./tools/h5diff/testfiles/h5diff_422.txt +./tools/h5diff/testfiles/h5diff_423.txt +./tools/h5diff/testfiles/h5diff_424.txt +./tools/h5diff/testfiles/h5diff_425.txt +./tools/h5diff/testfiles/h5diff_450.txt +./tools/h5diff/testfiles/h5diff_451.txt +./tools/h5diff/testfiles/h5diff_452.txt +./tools/h5diff/testfiles/h5diff_453.txt +./tools/h5diff/testfiles/h5diff_454.txt +./tools/h5diff/testfiles/h5diff_455.txt +./tools/h5diff/testfiles/h5diff_456.txt +./tools/h5diff/testfiles/h5diff_457.txt +./tools/h5diff/testfiles/h5diff_458.txt +./tools/h5diff/testfiles/h5diff_459.txt + + +./tools/h5diff/testfiles/h5diff_attr1.h5 +./tools/h5diff/testfiles/h5diff_attr2.h5 +./tools/h5diff/testfiles/h5diff_basic1.h5 +./tools/h5diff/testfiles/h5diff_basic2.h5 +./tools/h5diff/testfiles/h5diff_dset1.h5 +./tools/h5diff/testfiles/h5diff_dset2.h5 +./tools/h5diff/testfiles/h5diff_dtypes.h5 +./tools/h5diff/testfiles/h5diff_empty.h5 +./tools/h5diff/testfiles/h5diff_hyper1.h5 +./tools/h5diff/testfiles/h5diff_hyper2.h5 +./tools/h5diff/testfiles/h5diff_types.h5 ./tools/h5diff/testfiles/h5diff_links.h5 +./tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 +./tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 +./tools/h5diff/testfiles/h5diff_extlink_src.h5 +./tools/h5diff/testfiles/h5diff_extlink_trg.h5 +./tools/h5diff/testfiles/h5diff_linked_softlink.h5 +./tools/h5diff/testfiles/h5diff_softlinks.h5 +./tools/h5diff/testfiles/h5diff_danglelinks1.h5 +./tools/h5diff/testfiles/h5diff_danglelinks2.h5 diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6b42dec..88c3741 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -74,6 +74,12 @@ New Features Tools ----- + - h5diff: fixed incorrect behavior (hang) in parallel mode when + specify invalid options (ex: -v and -q) (JKM 2010/02/17) + - h5diff: Add new flag --no-dangling-links. (refer to --help for details) + (JKM - 2010/02/10) + - h5diff: Add new flag --follow-links. (refer to --help for details) + (JKM - 2010/01/25) - h5diff: fix for displaying garbage value on LE machine for BE data. (JKM - 2009/11/20) diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index c0bad1c..75e1774 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -44,6 +44,8 @@ static struct long_options l_opts[] = { { "nan", no_arg, 'N' }, { "compare", no_arg, 'c' }, { "use-system-epsilon", no_arg, 'e' }, + { "follow-links", no_arg, 'l' }, + { "no-dangling-links", no_arg, 'x' }, { NULL, 0, '\0' } }; @@ -100,6 +102,12 @@ void parse_command_line(int argc, case 'r': options->m_report = 1; break; + case 'l': + options->follow_links = 1; + break; + case 'x': + options->no_dangle_links = 1; + break; case 'd': options->d=1; @@ -352,32 +360,68 @@ void usage(void) printf(" file2 File name of the second HDF5 file\n"); printf(" [obj1] Name of an HDF5 object, in absolute path\n"); printf(" [obj2] Name of an HDF5 object, in absolute path\n"); - + printf("\n"); printf(" OPTIONS\n"); - - printf(" -h, --help Print a usage message and exit\n"); - printf(" -V, --version Print version number and exit\n"); - printf(" -r, --report Report mode. Print differences\n"); - printf(" -v, --verbose Verbose mode. Print differences, list of objects\n"); - printf(" -q, --quiet Quiet mode. Do not do output\n"); + printf(" -h, --help Print a usage message and exit.\n"); + printf(" -V, --version Print version number and exit.\n"); + printf(" -r, --report Report mode. Print differences.\n"); + printf(" -v, --verbose Verbose mode. Print differences, list of objects.\n"); + printf(" -q, --quiet Quiet mode. Do not produce output.\n"); + printf(" --follow-links Follow symbolic links (soft links and external links)\n"); + printf(" and compare the links' target objects.\n"); + printf(" If symbolic link(s) with the same name exist in the\n"); + printf(" files being compared, then determine whether the \n"); + printf(" target of each link is an existing object (dataset,\n"); + printf(" group, or named datatype) or the link is a dangling\n"); + printf(" link (a soft or external link pointing to a target\n"); + printf(" object that does not yet exist).\n"); + printf(" - If both symbolic links are dangling links, they\n"); + printf(" are treated as being the same; by default, h5diff\n"); + printf(" returns an exit code of 0. If, however, \n"); + printf(" --no-dangling-links is used with --follow-links, \n"); + printf(" this situation is treated as an error and h5diff \n"); + printf(" returns an exit code of 2.\n"); + printf(" - If only one of the two links is a dangling link,\n"); + printf(" they are treated as being different and h5diff \n"); + printf(" returns an exit code of 1. If, however, \n"); + printf(" --no-dangling-links is used with --follow-links, \n"); + printf(" this situation is treated as an error and h5diff \n"); + printf(" returns an exit code of 2.\n"); + printf(" - If both symbolic links point to existing objects,\n"); + printf(" h5diff compares the two objects.\n"); + printf(" If any symbolic link specified in the call to h5diff\n"); + printf(" does not exist, h5diff treats it as an error and\n"); + printf(" returns an exit code of 2.\n"); + printf(" --no-dangling-links Must be used with --follow-links option;\n"); + printf(" otherwise, h5diff shows error message and returns\n"); + printf(" an exit code of 2.\n"); + printf(" Check for any symbolic links (soft links or external\n"); + printf(" links) that do not resolve to an existing object\n"); + printf(" (dataset, group, or named datatype). If any\n"); + printf(" dangling link is found, this situation is treated as\n"); + printf(" an error and h5diff returns an exit code of 2.\n"); printf(" -c, --compare List objects that are not comparable\n"); printf(" -N, --nan Avoid NaNs detection\n"); - printf(" -n C, --count=C Print differences up to C number, C is a positive integer.\n"); - - printf(" -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.\n"); - printf(" -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.\n"); + printf(" -n C, --count=C Print differences up to C number, C is a positive\n"); + printf(" integer.\n"); + printf(" -d D, --delta=D Print difference if (|a-b| > D), D is a positive\n"); + printf(" number.\n"); + printf(" -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive\n"); + printf(" number.\n"); printf(" --use-system-epsilon Print difference if (|a-b| > EPSILON),\n"); - printf(" where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. \n"); - printf(" If the system epsilon is not defined, use the value below:\n"); + printf(" where EPSILON (FLT_EPSILON or FLT_EPSILON) is the\n"); + printf(" system epsilon value. \n"); + printf(" If the system epsilon is not defined, use the value\n"); + printf(" below:\n"); printf(" FLT_EPSILON = 1.19209E-07 for float\n"); printf(" DBL_EPSILON = 2.22045E-16 for double\n"); - - printf(" -d, -p, and --use-system-epsilon options are used for comparing floating point values.\n"); - printf(" By default, strict equality is used. Use -p or -d to set specific tolerance.\n"); + printf(" -d, -p, and --use-system-epsilon options are used for\n"); + printf(" comparing floating point values.\n"); + printf(" By default, strict equality is used. Use -p or -d to\n"); + printf(" set specific tolerance.\n"); printf("\n"); printf(" Modes of output:\n"); - printf("\n"); printf(" Default mode: print the number of differences found and where they occured\n"); printf(" -r Report mode: print the above plus the differences\n"); printf(" -v Verbose mode: print the above plus a list of objects and warnings\n"); @@ -386,46 +430,35 @@ void usage(void) printf("\n"); printf(" Compare criteria\n"); - printf("\n"); - printf(" If no objects [obj1[obj2]] are specified, h5diff only compares objects\n"); - printf(" with the same absolute path in both files\n"); + printf(" If no objects [obj1[obj2]] are specified, h5diff only compares objects\n"); + printf(" with the same absolute path in both files\n"); printf("\n"); printf(" The compare criteria is:\n"); - printf(" 1) datasets: numerical array differences 2) groups: name string difference\n"); - printf(" 3) datatypes: the return value of H5Tequal 4) links: name string difference\n"); - printf(" of the linked value\n"); - - printf("\n"); - - printf(" Return exit code:\n"); + printf(" 1) datasets: numerical array differences\n"); + printf(" 2) groups: name string difference\n"); + printf(" 3) datatypes: the return value of H5Tequal\n"); + printf(" 4) links: name string difference of the linked value as default\n"); + printf(" (refer to --follow-links option).\n"); printf("\n"); - printf(" 1 if differences found, 0 if no differences, 2 if error\n"); - + printf(" Exit code:\n"); + printf(" 0 if no differences, 1 if differences found, 2 if error\n"); printf("\n"); - printf(" Examples of use:\n"); - printf("\n"); printf(" 1) h5diff file1 file2 /g1/dset1 /g1/dset2\n"); - printf("\n"); printf(" Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n"); printf("\n"); printf(" 2) h5diff file1 file2 /g1/dset1\n"); - printf("\n"); printf(" Compares object '/g1/dset1' in both files\n"); printf("\n"); printf(" 3) h5diff file1 file2\n"); - printf("\n"); printf(" Compares all objects in both files\n"); printf("\n"); - printf(" Note) file1 and file2 can be the same file. Use\n"); - printf("\n"); - printf(" h5diff file1 file1 /g1/dset1 /g1/dset2\n"); - printf("\n"); - printf(" to compare '/g1/dset1' and '/g1/dset2' in the same file\n"); + printf(" Notes:\n"); + printf(" file1 and file2 can be the same file.\n"); + printf(" Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare\n"); + printf(" '/g1/dset1' and '/g1/dset2' in the same file\n"); printf("\n"); - - } diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index 1cb8f2f..8089161 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -97,6 +97,7 @@ int main(int argc, const char *argv[]) print_info(&options); +out: /*------------------------------------------------------------------------- * exit code * 1 if differences, 0 if no differences, 2 if error diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index e4f9691..c62da08 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -43,6 +43,16 @@ #define FILE9 "h5diff_hyper1.h5" #define FILE10 "h5diff_hyper2.h5" #define FILE11 "h5diff_empty.h5" +#define FILE12 "h5diff_links.h5" +#define FILE13 "h5diff_softlinks.h5" +#define FILE14 "h5diff_linked_softlink.h5" +#define FILE15 "h5diff_extlink_src.h5" +#define FILE16 "h5diff_extlink_trg.h5" +#define FILE17 "h5diff_ext2softlink_src.h5" +#define FILE18 "h5diff_ext2softlink_trg.h5" +#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5" +#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.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 ) @@ -80,6 +90,13 @@ static int test_datatypes(const char *fname); static int test_attributes(const char *fname,int make_diffs); static int test_datasets(const char *fname,int make_diffs); static int test_hyperslab(const char *fname,int make_diffs); +static int test_link_name(const char *fname1); +static int test_soft_links(const char *fname1); +static int test_linked_softlinks(const char *fname1); +static int test_external_links(const char *fname1, const char *fname2); +static int test_ext2soft_links(const char *fname1, const char *fname2); +static int test_dangle_links(const char *fname1, const char *fname2); + /* called by test_attributes() and test_datasets() */ static void write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs); static void write_dset_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs); @@ -118,8 +135,20 @@ int main(void) /* generate 2 files, the second call creates a similar file with differences */ test_hyperslab(FILE9,0); test_hyperslab(FILE10,1); - return 0; + test_link_name(FILE12); + + test_soft_links(FILE13); + + test_linked_softlinks(FILE14); + + test_external_links(FILE15, FILE16); + + test_ext2soft_links(FILE17, FILE18); + + test_dangle_links(DANGLE_LINK_FILE1, DANGLE_LINK_FILE2); + + return 0; } /*------------------------------------------------------------------------- @@ -893,6 +922,918 @@ int test_datasets(const char *file, } /*------------------------------------------------------------------------- +* +* Purpose: Create test files to compare links, one has longer name than +* the other and short name is subset of long name. +* +* Programmer: Jonathan Kim (Feb 17, 2010) +* +*-------------------------------------------------------------------------*/ +static int test_link_name(const char *fname1) +{ + hid_t fid1=0; + hid_t gid1=0; + hid_t gid2=0; + herr_t status = SUCCEED; + + /*----------------------------------------------------------------------- + * Create file(s) + *------------------------------------------------------------------------*/ + fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Groups + *------------------------------------------------------------------------*/ + gid1 = H5Gcreate2(fid1, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid1 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + status = FAIL; + goto out; + } + gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + if (gid2 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Soft Links + *------------------------------------------------------------------------*/ + status = H5Lcreate_soft("group", fid1, "link_g1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("group_longname", fid1, "link_g2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + +out: + /*----------------------------------------------------------------------- + * Close + *------------------------------------------------------------------------*/ + if(fid1) + H5Fclose(fid1); + if(gid1) + H5Gclose(gid1); + if(gid2) + H5Gclose(gid2); + + return status; +} + +/*------------------------------------------------------------------------- +* +* Purpose: Create test files to compare soft links in various way +* +* Programmer: Jonathan Kim (Feb 17, 2010) +* +*-------------------------------------------------------------------------*/ +static int test_soft_links(const char *fname1) +{ + hid_t fid1=0; + hid_t gid1=0; + hsize_t dims2[2] = {2,4}; + herr_t status = SUCCEED; + + /*----------------------------------------------------------------------- + * Create file(s) + *------------------------------------------------------------------------*/ + fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Groups + *------------------------------------------------------------------------*/ + gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid1 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Datasets + *------------------------------------------------------------------------*/ + int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; + int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; + + /* file1 */ + status = write_dset(fid1,2,dims2,"target_dset1",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + status = FAIL; + goto out; + } + + status = write_dset(fid1,2,dims2,"target_dset2",H5T_NATIVE_INT,data2); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + status = FAIL; + goto out; + } + + status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Soft Links + *------------------------------------------------------------------------*/ + /* file 1 */ + status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("/target_dset2", fid1, "softlink_dset2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("/target_group", fid1, "softlink_group1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("/target_group", fid1, "softlink_group2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("/no_obj", fid1, "softlink_noexist", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + +out: + /*----------------------------------------------------------------------- + * Close + *-----------------------------------------------------------------------*/ + if(fid1) + H5Fclose(fid1); + if(gid1) + H5Gclose(gid1); + + return status; +} + +/*------------------------------------------------------------------------- +* +* Purpose: Create test files to compare linked soft links in various way +* +* Programmer: Jonathan Kim (Feb 17, 2010) +* +*-------------------------------------------------------------------------*/ +static int test_linked_softlinks(const char *fname1) +{ + hid_t fid1=0; + hid_t gid1=0; + hid_t gid2=0; + hid_t gid3=0; + hsize_t dims2[2] = {2,4}; + herr_t status = SUCCEED; + + /*----------------------------------------------------------------------- + * Create file(s) + *------------------------------------------------------------------------*/ + fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Groups + *------------------------------------------------------------------------*/ + gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid1 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + status = FAIL; + goto out; + } + + gid2 = H5Gcreate2(fid1, "target_group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid2 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + status = FAIL; + goto out; + } + + gid3 = H5Gcreate2(fid1, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid3 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Datasets + *------------------------------------------------------------------------*/ + int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; + int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; + + /* file1 */ + status = write_dset(fid1,2,dims2,"target_dset1",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + status = FAIL; + goto out; + } + + status = write_dset(fid1,2,dims2,"target_dset2",H5T_NATIVE_INT,data2); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + status = FAIL; + goto out; + } + status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Soft Links (Linked) + *------------------------------------------------------------------------*/ + /*--------- + * file 1 */ + status = H5Lcreate_soft("/target_dset1", fid1, "softlink1_to_dset1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("softlink1_to_dset1", fid1, "softlink1_to_slink1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("softlink1_to_slink1", fid1, "softlink1_to_slink2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("/target_dset2", fid1, "softlink2_to_dset2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("softlink2_to_dset2", fid1, "softlink2_to_slink1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("softlink2_to_slink1", fid1, "softlink2_to_slink2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("target_group1", fid1, "softlink3_to_group1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("softlink3_to_group1", fid1, "softlink3_to_slink1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("softlink3_to_slink1", fid1, "softlink3_to_slink2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("target_group2", fid1, "softlink4_to_group2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("softlink4_to_group2", fid1, "softlink4_to_slink1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("softlink4_to_slink1", fid1, "softlink4_to_slink2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + +out: + /*----------------------------------------------------------------------- + * Close + *-----------------------------------------------------------------------*/ + if(fid1) + H5Fclose(fid1); + if(gid1) + H5Gclose(gid1); + if(gid2) + H5Gclose(gid2); + if(gid3) + H5Gclose(gid3); + + return status; +} + +/*------------------------------------------------------------------------- +* +* Purpose: Create test files to compare external links in various way +* +* Programmer: Jonathan Kim (Feb 17, 2010) +* +*-------------------------------------------------------------------------*/ +static int test_external_links(const char *fname1, const char *fname2) +{ + hid_t fid1=0; + hid_t fid2=0; + hid_t gid1=0; + hid_t gid2=0; + hsize_t dims2[2] = {2,4}; + herr_t status = SUCCEED; + + /*----------------------------------------------------------------------- + * Create file(s) + *------------------------------------------------------------------------*/ + /* source file */ + fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + status = FAIL; + goto out; + } + + /* target file */ + fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Groups + *------------------------------------------------------------------------*/ + /*-------------- + * target file */ + gid1 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid1 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + status = FAIL; + goto out; + } + + gid2 = H5Gcreate2(fid2, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid2 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + status = FAIL; + goto out; + } + /*----------------------------------------------------------------------- + * Datasets + *------------------------------------------------------------------------*/ + int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; + int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; + + /*-------------- + * target file */ + status = write_dset(fid2,2,dims2,"target_dset1",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + status = FAIL; + goto out; + } + + status = write_dset(gid1,2,dims2,"x_dset",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + status = FAIL; + goto out; + } + + status = write_dset(gid2,2,dims2,"x_dset",H5T_NATIVE_INT,data2); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * External Links + *------------------------------------------------------------------------*/ + /*-------------- + /* source file */ + status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_external(fname2, "/target_group", fid1, "/ext_link_grp1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_external(fname2, "/target_group2", fid1, "/ext_link_grp2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link_noexist1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link_noexist2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + +out: + /*----------------------------------------------------------------------- + * Close + *-----------------------------------------------------------------------*/ + if(fid1) + H5Fclose(fid1); + if(fid2) + H5Fclose(fid2); + if(gid1) + H5Gclose(gid1); + if(gid2) + H5Gclose(gid2); + + return status; +} + +/*------------------------------------------------------------------------- +* +* Purpose: Create test files to compare external links which point to +* soft link in various way +* +* Programmer: Jonathan Kim (Feb 17, 2010) +* +*-------------------------------------------------------------------------*/ +static int test_ext2soft_links(const char *fname1, const char *fname2) +{ + hid_t fid1=0; + hid_t fid2=0; + hid_t gid2=0; + hsize_t dims2[2] = {2,4}; + herr_t status = SUCCEED; + + /*----------------------------------------------------------------------- + * Create file(s) + *------------------------------------------------------------------------*/ + /* source file */ + fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + status = FAIL; + goto out; + } + + /* target file */ + fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Groups + *------------------------------------------------------------------------*/ + /* target file */ + gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid2 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Datasets + *------------------------------------------------------------------------*/ + int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; + int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; + + /*-------------- + * target file */ + status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data2); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + status = FAIL; + goto out; + } + + status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Soft Links (Linked) + *------------------------------------------------------------------------*/ + /*--------------- + * target file */ + status = H5Lcreate_soft("/dset1", fid2, "softlink_to_dset1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("/dset2", fid2, "softlink_to_dset2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * External Links + *------------------------------------------------------------------------*/ + /*--------------- + * source file */ + status = H5Lcreate_external(fname2, "/target_group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + +out: + /*----------------------------------------------------------------------- + * Close + *-----------------------------------------------------------------------*/ + if(fid1) + H5Fclose(fid1); + if(fid2) + H5Fclose(fid2); + if(gid2) + H5Gclose(gid2); + + return status; +} + +/*------------------------------------------------------------------------- +* +* Purpose: Create test files to compare dangling links in various way +* +* Programmer: Jonathan Kim (Feb 17, 2010) +* +*-------------------------------------------------------------------------*/ +static int test_dangle_links(const char *fname1, const char *fname2) +{ + hid_t fid1=0; + hid_t fid2=0; + hsize_t dims2[2] = {2,4}; + herr_t status = SUCCEED; + + /*----------------------------------------------------------------------- + * Create file(s) + *------------------------------------------------------------------------*/ + fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + status = FAIL; + goto out; + } + + fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Datasets + *------------------------------------------------------------------------*/ + int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; + int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; + + /* file1 */ + status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + status = FAIL; + goto out; + } + + status = write_dset(fid1,2,dims2,"dset2",H5T_NATIVE_INT,data2); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + status = FAIL; + goto out; + } + + /* file2 */ + status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + status = FAIL; + goto out; + } + + status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data2); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Soft Links + *------------------------------------------------------------------------*/ + /* file 1 */ + status = H5Lcreate_soft("no_obj", fid1, "soft_link1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("/dset1", fid1, "soft_link2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("no_obj", fid1, "soft_link3", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + + /* file 2 */ + status = H5Lcreate_soft("no_obj", fid2, "soft_link1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("no_obj", fid2, "soft_link2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + status = FAIL; + goto out; + } + + status = H5Lcreate_soft("/dset2", fid2, "soft_link3", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * External Links + *------------------------------------------------------------------------*/ + /* file1 */ + status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_external(fname2, "/dset1", fid1, "ext_link2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link3", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + status = H5Lcreate_external("no_file1.h5", "no_obj", fid1, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + status = FAIL; + goto out; + } + + /* file2 */ + status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + status = FAIL; + goto out; + } + + status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link2", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + status = FAIL; + goto out; + } + + status = H5Lcreate_external(fname1, "/dset2", fid2, "ext_link3", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + status = FAIL; + goto out; + } + + status = H5Lcreate_external("no_file2.h5", "no_obj", fid2, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + status = FAIL; + goto out; + } + +out: + /*----------------------------------------------------------------------- + * Close + *-----------------------------------------------------------------------*/ + if(fid1) + H5Fclose(fid1); + if(fid2) + H5Fclose(fid2); + + return status; +} + +/*------------------------------------------------------------------------- * Function: write_attr_in * * Purpose: write attributes in LOC_ID (dataset, group, named datatype) diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt index 4788a79..aeba845 100644 --- a/tools/h5diff/testfiles/h5diff_10.txt +++ b/tools/h5diff/testfiles/h5diff_10.txt @@ -3,63 +3,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] file2 File name of the second HDF5 file [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -r, --report Report mode. Print differences - -v, --verbose Verbose mode. Print differences, list of objects - -q, --quiet Quiet mode. Do not do output + -h, --help Print a usage message and exit. + -V, --version Print version number and exit. + -r, --report Report mode. Print differences. + -v, --verbose Verbose mode. Print differences, list of objects. + -q, --quiet Quiet mode. Do not produce output. + --follow-links Follow symbolic links (soft links and external links) + and compare the links' target objects. + If symbolic link(s) with the same name exist in the + files being compared, then determine whether the + target of each link is an existing object (dataset, + group, or named datatype) or the link is a dangling + link (a soft or external link pointing to a target + object that does not yet exist). + - If both symbolic links are dangling links, they + are treated as being the same; by default, h5diff + returns an exit code of 0. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If only one of the two links is a dangling link, + they are treated as being different and h5diff + returns an exit code of 1. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If both symbolic links point to existing objects, + h5diff compares the two objects. + If any symbolic link specified in the call to h5diff + does not exist, h5diff treats it as an error and + returns an exit code of 2. + --no-dangling-links Must be used with --follow-links option; + otherwise, h5diff shows error message and returns + an exit code of 2. + Check for any symbolic links (soft links or external + links) that do not resolve to an existing object + (dataset, group, or named datatype). If any + dangling link is found, this situation is treated as + an error and h5diff returns an exit code of 2. -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection - -n C, --count=C Print differences up to C number, C is a positive integer. - -d D, --delta=D Print difference if (|a-b| > D), D is a positive number. - -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. + -n C, --count=C Print differences up to C number, C is a positive + integer. + -d D, --delta=D Print difference if (|a-b| > D), D is a positive + number. + -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive + number. --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. - If the system epsilon is not defined, use the value below: + where EPSILON (FLT_EPSILON or FLT_EPSILON) is the + system epsilon value. + If the system epsilon is not defined, use the value + below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for comparing floating point values. - By default, strict equality is used. Use -p or -d to set specific tolerance. + -d, -p, and --use-system-epsilon options are used for + comparing floating point values. + By default, strict equality is used. Use -p or -d to + set specific tolerance. Modes of output: - Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output Compare criteria - - If no objects [obj1[obj2]] are specified, h5diff only compares objects - with the same absolute path in both files + If no objects [obj1[obj2]] are specified, h5diff only compares objects + with the same absolute path in both files The compare criteria is: - 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 4) links: name string difference - of the linked value + 1) datasets: numerical array differences + 2) groups: name string difference + 3) datatypes: the return value of H5Tequal + 4) links: name string difference of the linked value as default + (refer to --follow-links option). - Return exit code: - - 1 if differences found, 0 if no differences, 2 if error + Exit code: + 0 if no differences, 1 if differences found, 2 if error Examples of use: - 1) h5diff file1 file2 /g1/dset1 /g1/dset2 - Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2 2) h5diff file1 file2 /g1/dset1 - Compares object '/g1/dset1' in both files 3) h5diff file1 file2 - Compares all objects in both files - Note) file1 and file2 can be the same file. Use - - h5diff file1 file1 /g1/dset1 /g1/dset2 - - to compare '/g1/dset1' and '/g1/dset2' in the same file + Notes: + file1 and file2 can be the same file. + Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare + '/g1/dset1' and '/g1/dset2' in the same file +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_100.txt b/tools/h5diff/testfiles/h5diff_100.txt index 32ff7ab..363daa3 100644 --- a/tools/h5diff/testfiles/h5diff_100.txt +++ b/tools/h5diff/testfiles/h5diff_100.txt @@ -1035,3 +1035,4 @@ position big big difference [ 268436478 ] 31 0 31 [ 268436479 ] 31 0 31 1024 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_101.txt b/tools/h5diff/testfiles/h5diff_101.txt index 03875b7..1d0f38d 100644 --- a/tools/h5diff/testfiles/h5diff_101.txt +++ b/tools/h5diff/testfiles/h5diff_101.txt @@ -7,3 +7,4 @@ position d1 d2 difference [ 1 1 ] 0 1e-09 1e-09 [ 2 0 ] 1e-09 0 1e-09 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_102.txt b/tools/h5diff/testfiles/h5diff_102.txt index 3d91a36..30a2491 100644 --- a/tools/h5diff/testfiles/h5diff_102.txt +++ b/tools/h5diff/testfiles/h5diff_102.txt @@ -7,3 +7,4 @@ position fp1 fp2 difference [ 1 1 ] 0 1e-05 1e-05 [ 2 0 ] 1e-05 0 1e-05 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_11.txt b/tools/h5diff/testfiles/h5diff_11.txt index e2e33fb..c06305c 100644 --- a/tools/h5diff/testfiles/h5diff_11.txt +++ b/tools/h5diff/testfiles/h5diff_11.txt @@ -1,2 +1,3 @@ dataset: and 5 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_12.txt b/tools/h5diff/testfiles/h5diff_12.txt index 6b4c747..371df79 100644 --- a/tools/h5diff/testfiles/h5diff_12.txt +++ b/tools/h5diff/testfiles/h5diff_12.txt @@ -1,2 +1,3 @@ dataset: and 5 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_13.txt b/tools/h5diff/testfiles/h5diff_13.txt index 36676e9..729859b 100644 --- a/tools/h5diff/testfiles/h5diff_13.txt +++ b/tools/h5diff/testfiles/h5diff_13.txt @@ -8,3 +8,4 @@ position dset1 dset1 difference [ 1 1 ] 1 1.001 0.001 [ 2 1 ] 0 1 1 5 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_14.txt b/tools/h5diff/testfiles/h5diff_14.txt index 3fac3af..454463a 100644 --- a/tools/h5diff/testfiles/h5diff_14.txt +++ b/tools/h5diff/testfiles/h5diff_14.txt @@ -8,3 +8,4 @@ position dset1 dset2 difference [ 1 1 ] 1 1.001 0.001 [ 2 1 ] 0 1 1 5 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_15.txt b/tools/h5diff/testfiles/h5diff_15.txt index 386c6e1..7685f75 100644 --- a/tools/h5diff/testfiles/h5diff_15.txt +++ b/tools/h5diff/testfiles/h5diff_15.txt @@ -7,3 +7,4 @@ position dset3 dset4 difference [ 2 0 ] 100 80 20 [ 2 1 ] 100 40 60 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_16_1.txt b/tools/h5diff/testfiles/h5diff_16_1.txt index 519f695..482a42f 100644 --- a/tools/h5diff/testfiles/h5diff_16_1.txt +++ b/tools/h5diff/testfiles/h5diff_16_1.txt @@ -8,3 +8,4 @@ position dset5 dset6 difference relative [ 1 1 ] 0 100 100 not comparable [ 2 1 ] 100 50 50 0.500000 5 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_16_2.txt b/tools/h5diff/testfiles/h5diff_16_2.txt index 233b133..34c1afb 100644 --- a/tools/h5diff/testfiles/h5diff_16_2.txt +++ b/tools/h5diff/testfiles/h5diff_16_2.txt @@ -8,3 +8,4 @@ position dset7 dset8 difference relative [ 1 1 ] 0 100 100 not comparable [ 2 1 ] 100 50 50 0.500000 5 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_16_3.txt b/tools/h5diff/testfiles/h5diff_16_3.txt index b96c8a4..173a39b 100644 --- a/tools/h5diff/testfiles/h5diff_16_3.txt +++ b/tools/h5diff/testfiles/h5diff_16_3.txt @@ -8,3 +8,4 @@ position dset9 dset10 difference relative [ 1 1 ] 0 100 100 not comparable [ 2 1 ] 100 50 50 0.5 5 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_17.txt b/tools/h5diff/testfiles/h5diff_17.txt index dce5ef5..5cb604d 100644 --- a/tools/h5diff/testfiles/h5diff_17.txt +++ b/tools/h5diff/testfiles/h5diff_17.txt @@ -51,3 +51,4 @@ position dset1 dset1 difference [ 1 1 ] 1 1.001 0.001 [ 2 1 ] 0 1 1 5 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_171.txt b/tools/h5diff/testfiles/h5diff_171.txt index 7ee0711..5314a79 100644 --- a/tools/h5diff/testfiles/h5diff_171.txt +++ b/tools/h5diff/testfiles/h5diff_171.txt @@ -1,2 +1,3 @@ dataset: and 0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_172.txt b/tools/h5diff/testfiles/h5diff_172.txt index e2d1b7d..0269194 100644 --- a/tools/h5diff/testfiles/h5diff_172.txt +++ b/tools/h5diff/testfiles/h5diff_172.txt @@ -1,2 +1,3 @@ dataset: and 0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_18.txt b/tools/h5diff/testfiles/h5diff_18.txt index e69de29..1255241 100644 --- a/tools/h5diff/testfiles/h5diff_18.txt +++ b/tools/h5diff/testfiles/h5diff_18.txt @@ -0,0 +1 @@ +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_18_1.txt b/tools/h5diff/testfiles/h5diff_18_1.txt new file mode 100644 index 0000000..0067075 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_18_1.txt @@ -0,0 +1,2 @@ +Error: -q (quiet mode) cannot be added to verbose or report modes +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_20.txt b/tools/h5diff/testfiles/h5diff_20.txt index b2fda7c..6eba851 100644 --- a/tools/h5diff/testfiles/h5diff_20.txt +++ b/tools/h5diff/testfiles/h5diff_20.txt @@ -3,3 +3,4 @@ Some objects are not comparable -------------------------------- Use -c for a list of objects. +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_200.txt b/tools/h5diff/testfiles/h5diff_200.txt index 56d723d..40e3fb6 100644 --- a/tools/h5diff/testfiles/h5diff_200.txt +++ b/tools/h5diff/testfiles/h5diff_200.txt @@ -2,3 +2,4 @@ Some objects are not comparable -------------------------------- Use -c for a list of objects. +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_201.txt b/tools/h5diff/testfiles/h5diff_201.txt index 84d6766..ede94e1 100644 --- a/tools/h5diff/testfiles/h5diff_201.txt +++ b/tools/h5diff/testfiles/h5diff_201.txt @@ -1 +1,2 @@ Not comparable: or is an empty dataset +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_202.txt b/tools/h5diff/testfiles/h5diff_202.txt index fd4a191..53657d3 100644 --- a/tools/h5diff/testfiles/h5diff_202.txt +++ b/tools/h5diff/testfiles/h5diff_202.txt @@ -1,2 +1,3 @@ Not comparable: is of class H5T_FLOAT and is of class H5T_INTEGER Not comparable: has sign H5T_SGN_ERROR and has sign H5T_SGN_2 +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_203.txt b/tools/h5diff/testfiles/h5diff_203.txt index 496523c..61a773a 100644 --- a/tools/h5diff/testfiles/h5diff_203.txt +++ b/tools/h5diff/testfiles/h5diff_203.txt @@ -1,2 +1,3 @@ Not comparable: has rank 1, dimensions [6], max dimensions [6] and has rank 2, dimensions [3x2], max dimensions [3x2] +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_204.txt b/tools/h5diff/testfiles/h5diff_204.txt index 098a203..e02e831 100644 --- a/tools/h5diff/testfiles/h5diff_204.txt +++ b/tools/h5diff/testfiles/h5diff_204.txt @@ -1,2 +1,3 @@ Not comparable: has rank 2, dimensions [3x2], max dimensions [3x2] and has rank 2, dimensions [2x2], max dimensions [2x2] +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_205.txt b/tools/h5diff/testfiles/h5diff_205.txt index 3e2d1f2..d72797b 100644 --- a/tools/h5diff/testfiles/h5diff_205.txt +++ b/tools/h5diff/testfiles/h5diff_205.txt @@ -1,3 +1,4 @@ Not comparable: has rank 2, dimensions [2x2], max dimensions [2x2] and has rank 2, dimensions [3x2], max dimensions [3x2] Not comparable: has sign H5T_SGN_2 and has sign H5T_SGN_NONE +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_206.txt b/tools/h5diff/testfiles/h5diff_206.txt index 164aed9..659321f 100644 --- a/tools/h5diff/testfiles/h5diff_206.txt +++ b/tools/h5diff/testfiles/h5diff_206.txt @@ -1 +1,2 @@ Not comparable: has a class H5T_FLOAT and has a class H5T_INTEGER +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_207.txt b/tools/h5diff/testfiles/h5diff_207.txt index bb8e23f..1ef3dbe 100644 --- a/tools/h5diff/testfiles/h5diff_207.txt +++ b/tools/h5diff/testfiles/h5diff_207.txt @@ -1,2 +1,3 @@ Not comparable: or is an empty dataset Not comparable: has 2 members has 1 members +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_21.txt b/tools/h5diff/testfiles/h5diff_21.txt index 5518e0c..238c8b8 100644 --- a/tools/h5diff/testfiles/h5diff_21.txt +++ b/tools/h5diff/testfiles/h5diff_21.txt @@ -3,3 +3,4 @@ Some objects are not comparable -------------------------------- Use -c for a list of objects. +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_22.txt b/tools/h5diff/testfiles/h5diff_22.txt index 0f9493b..33c3a3d 100644 --- a/tools/h5diff/testfiles/h5diff_22.txt +++ b/tools/h5diff/testfiles/h5diff_22.txt @@ -3,3 +3,4 @@ Some objects are not comparable -------------------------------- Use -c for a list of objects. +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_23.txt b/tools/h5diff/testfiles/h5diff_23.txt index 1342765..5a46ea2 100644 --- a/tools/h5diff/testfiles/h5diff_23.txt +++ b/tools/h5diff/testfiles/h5diff_23.txt @@ -1,2 +1,3 @@ group : and 0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_24.txt b/tools/h5diff/testfiles/h5diff_24.txt index cc4f0d0..fa5723a 100644 --- a/tools/h5diff/testfiles/h5diff_24.txt +++ b/tools/h5diff/testfiles/h5diff_24.txt @@ -1,2 +1,3 @@ datatype: and 0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_25.txt b/tools/h5diff/testfiles/h5diff_25.txt index 288c4da..e463ba1 100644 --- a/tools/h5diff/testfiles/h5diff_25.txt +++ b/tools/h5diff/testfiles/h5diff_25.txt @@ -1,2 +1,3 @@ link : and 0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_26.txt b/tools/h5diff/testfiles/h5diff_26.txt index 916cf63..8e1fcc3 100644 --- a/tools/h5diff/testfiles/h5diff_26.txt +++ b/tools/h5diff/testfiles/h5diff_26.txt @@ -1,2 +1,3 @@ group : and 1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_27.txt b/tools/h5diff/testfiles/h5diff_27.txt index 335119a..cbc128e 100644 --- a/tools/h5diff/testfiles/h5diff_27.txt +++ b/tools/h5diff/testfiles/h5diff_27.txt @@ -1,2 +1,3 @@ datatype: and 1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_28.txt b/tools/h5diff/testfiles/h5diff_28.txt index 5845fa9..07d01fe 100644 --- a/tools/h5diff/testfiles/h5diff_28.txt +++ b/tools/h5diff/testfiles/h5diff_28.txt @@ -1,2 +1,3 @@ link : and 1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_300.txt b/tools/h5diff/testfiles/h5diff_300.txt index 0cfc01b..e51643f 100755 --- a/tools/h5diff/testfiles/h5diff_300.txt +++ b/tools/h5diff/testfiles/h5diff_300.txt @@ -1,2 +1,3 @@ link : and 1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_400.txt b/tools/h5diff/testfiles/h5diff_400.txt new file mode 100644 index 0000000..97db70d --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_400.txt @@ -0,0 +1,48 @@ + +file1 file2 +--------------------------------------- + x x / + x x /softlink_dset1_1 + x x /softlink_dset1_2 + x x /softlink_dset2 + x x /softlink_group1 + x x /softlink_group2 + x x /softlink_noexist + x x /target_dset1 + x x /target_dset2 + x x /target_group + x x /target_group/dset + +group : and +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +dangling link: and +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +group : and +0 differences found +dataset: and +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_401.txt b/tools/h5diff/testfiles/h5diff_401.txt new file mode 100644 index 0000000..278729e --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_401.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position softlink_dset1_1 target_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_402.txt b/tools/h5diff/testfiles/h5diff_402.txt new file mode 100644 index 0000000..b0f30ca --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_402.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position target_dset2 softlink_dset1_1 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_403.txt b/tools/h5diff/testfiles/h5diff_403.txt new file mode 100644 index 0000000..068d01d --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_403.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position softlink_dset1_1 softlink_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_404.txt b/tools/h5diff/testfiles/h5diff_404.txt new file mode 100644 index 0000000..c9a476d --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_404.txt @@ -0,0 +1,34 @@ + +file1 file2 +--------------------------------------- + x x / + x x /ext_link_dset1 + x x /ext_link_dset2 + x x /ext_link_grp1 + x x /ext_link_grp2 + x x /ext_link_noexist1 + x x /ext_link_noexist2 + +group : and +0 differences found +external link: and +dataset: and +0 differences found +0 differences found +external link: and +dataset: and +0 differences found +0 differences found +external link: and +group : and +0 differences found +0 differences found +external link: and +group : and +0 differences found +0 differences found +dangling link: and +0 differences found +dangling link: and +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_405.txt b/tools/h5diff/testfiles/h5diff_405.txt new file mode 100644 index 0000000..890dd33 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_405.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position ext_link_dset1 x_dset difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_406.txt b/tools/h5diff/testfiles/h5diff_406.txt new file mode 100644 index 0000000..7fa442a --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_406.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position x_dset ext_link_dset1 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_407.txt b/tools/h5diff/testfiles/h5diff_407.txt new file mode 100644 index 0000000..3693ab9 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_407.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position ext_link_dset1 ext_link_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_408.txt b/tools/h5diff/testfiles/h5diff_408.txt new file mode 100644 index 0000000..e941f9b --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_408.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position softlink_dset1_1 ext_link_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_409.txt b/tools/h5diff/testfiles/h5diff_409.txt new file mode 100644 index 0000000..007da7d --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_409.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position ext_link_dset2 softlink_dset1_1 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_410.txt b/tools/h5diff/testfiles/h5diff_410.txt new file mode 100644 index 0000000..b0924f6 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_410.txt @@ -0,0 +1,86 @@ + +file1 file2 +--------------------------------------- + x x / + x x /softlink1_to_dset1 + x x /softlink1_to_slink1 + x x /softlink1_to_slink2 + x x /softlink2_to_dset2 + x x /softlink2_to_slink1 + x x /softlink2_to_slink2 + x x /softlink3_to_group1 + x x /softlink3_to_slink1 + x x /softlink3_to_slink2 + x x /softlink4_to_group2 + x x /softlink4_to_slink1 + x x /softlink4_to_slink2 + x x /target_dset1 + x x /target_dset2 + x x /target_group + x x /target_group/dset + x x /target_group1 + x x /target_group2 + +group : and +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +group : and +0 differences found +dataset: and +0 differences found +group : and +0 differences found +group : and +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_411.txt b/tools/h5diff/testfiles/h5diff_411.txt new file mode 100644 index 0000000..161ab34 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_411.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position target_dset2 softlink1_to_slink2 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_412.txt b/tools/h5diff/testfiles/h5diff_412.txt new file mode 100644 index 0000000..bb8209c --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_412.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position softlink1_to_slink2 target_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_413.txt b/tools/h5diff/testfiles/h5diff_413.txt new file mode 100644 index 0000000..8df3d51 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_413.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position softlink1_to_slink2 softlink2_to_slink2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_414.txt b/tools/h5diff/testfiles/h5diff_414.txt new file mode 100644 index 0000000..e7a991a --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_414.txt @@ -0,0 +1,3 @@ +group : and +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_415.txt b/tools/h5diff/testfiles/h5diff_415.txt new file mode 100644 index 0000000..1e97319 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_415.txt @@ -0,0 +1,3 @@ +group : and +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_416.txt b/tools/h5diff/testfiles/h5diff_416.txt new file mode 100644 index 0000000..e4e98b0 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_416.txt @@ -0,0 +1,3 @@ +group : and +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_417.txt b/tools/h5diff/testfiles/h5diff_417.txt new file mode 100644 index 0000000..0ea2542 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_417.txt @@ -0,0 +1,3 @@ +obj1 is a dangling link. +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_418.txt b/tools/h5diff/testfiles/h5diff_418.txt new file mode 100644 index 0000000..46222bb --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_418.txt @@ -0,0 +1,3 @@ +obj2 is a dangling link. +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_419.txt b/tools/h5diff/testfiles/h5diff_419.txt new file mode 100644 index 0000000..387c600 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_419.txt @@ -0,0 +1,3 @@ +obj1 is a dangling link. +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_420.txt b/tools/h5diff/testfiles/h5diff_420.txt new file mode 100644 index 0000000..f3e65d9 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_420.txt @@ -0,0 +1,3 @@ +obj2 is a dangling link. +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_421.txt b/tools/h5diff/testfiles/h5diff_421.txt new file mode 100644 index 0000000..833c60c --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_421.txt @@ -0,0 +1,3 @@ +obj2 is a dangling link. +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_422.txt b/tools/h5diff/testfiles/h5diff_422.txt new file mode 100644 index 0000000..3e675d5 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_422.txt @@ -0,0 +1,3 @@ +obj1 is a dangling link. +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_423.txt b/tools/h5diff/testfiles/h5diff_423.txt new file mode 100644 index 0000000..1ebc157 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_423.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position ext_link_to_slink1 dset2 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_424.txt b/tools/h5diff/testfiles/h5diff_424.txt new file mode 100644 index 0000000..9099c41 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_424.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position dset2 ext_link_to_slink1 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_425.txt b/tools/h5diff/testfiles/h5diff_425.txt new file mode 100644 index 0000000..03ceb78 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_425.txt @@ -0,0 +1,13 @@ +dataset: and +size: [2x4] [2x4] +position ext_link_to_slink1 ext_link_to_slink2 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_450.txt b/tools/h5diff/testfiles/h5diff_450.txt new file mode 100644 index 0000000..bf4f6e9 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_450.txt @@ -0,0 +1,35 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dset1 + x x /dset2 + x x /ext_link1 + x x /ext_link2 + x x /ext_link3 + x x /ext_link4 + x x /soft_link1 + x x /soft_link2 + x x /soft_link3 + +group : and +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +dangling link: and +0 differences found +obj2 is a dangling link. +1 differences found +obj1 is a dangling link. +1 differences found +dangling link: and +0 differences found +dangling link: and +0 differences found +obj2 is a dangling link. +1 differences found +obj1 is a dangling link. +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_451.txt b/tools/h5diff/testfiles/h5diff_451.txt new file mode 100644 index 0000000..0d30023 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_451.txt @@ -0,0 +1,28 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dset1 + x x /dset2 + x x /ext_link1 + x x /ext_link2 + x x /ext_link3 + x x /ext_link4 + x x /soft_link1 + x x /soft_link2 + x x /soft_link3 + +group : and +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +Warning: is a dangling link. +Warning: is a dangling link. +Warning: is a dangling link. +Warning: is a dangling link. +Warning: is a dangling link. +Warning: is a dangling link. +Warning: is a dangling link. +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_452.txt b/tools/h5diff/testfiles/h5diff_452.txt new file mode 100644 index 0000000..76e4457 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_452.txt @@ -0,0 +1,2 @@ +Error: --no-dangling-links must be used along with --follow-links option. +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_453.txt b/tools/h5diff/testfiles/h5diff_453.txt new file mode 100644 index 0000000..9c4d61b --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_453.txt @@ -0,0 +1,47 @@ + +file1 file2 +--------------------------------------- + x x / + x x /softlink_dset1_1 + x x /softlink_dset1_2 + x x /softlink_dset2 + x x /softlink_group1 + x x /softlink_group2 + x x /softlink_noexist + x x /target_dset1 + x x /target_dset2 + x x /target_group + x x /target_group/dset + +group : and +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +dataset: and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +link : and +group : and +0 differences found +0 differences found +Warning: is a dangling link. +dataset: and +0 differences found +dataset: and +0 differences found +group : and +0 differences found +dataset: and +0 differences found +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_454.txt b/tools/h5diff/testfiles/h5diff_454.txt new file mode 100644 index 0000000..dcc2e9c --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_454.txt @@ -0,0 +1,2 @@ +Warning: is a dangling link. +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_455.txt b/tools/h5diff/testfiles/h5diff_455.txt new file mode 100644 index 0000000..dcc2e9c --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_455.txt @@ -0,0 +1,2 @@ +Warning: is a dangling link. +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_456.txt b/tools/h5diff/testfiles/h5diff_456.txt new file mode 100644 index 0000000..f20e403 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_456.txt @@ -0,0 +1,32 @@ + +file1 file2 +--------------------------------------- + x x / + x x /ext_link_dset1 + x x /ext_link_dset2 + x x /ext_link_grp1 + x x /ext_link_grp2 + x x /ext_link_noexist1 + x x /ext_link_noexist2 + +group : and +0 differences found +external link: and +dataset: and +0 differences found +0 differences found +external link: and +dataset: and +0 differences found +0 differences found +external link: and +group : and +0 differences found +0 differences found +external link: and +group : and +0 differences found +0 differences found +Warning: is a dangling link. +Warning: is a dangling link. +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_457.txt b/tools/h5diff/testfiles/h5diff_457.txt new file mode 100644 index 0000000..762ccdc --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_457.txt @@ -0,0 +1,2 @@ +Warning: is a dangling link. +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_458.txt b/tools/h5diff/testfiles/h5diff_458.txt new file mode 100644 index 0000000..067d665 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_458.txt @@ -0,0 +1,2 @@ +Warning: is a dangling link. +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_459.txt b/tools/h5diff/testfiles/h5diff_459.txt new file mode 100644 index 0000000..762ccdc --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_459.txt @@ -0,0 +1,2 @@ +Warning: is a dangling link. +EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_50.txt b/tools/h5diff/testfiles/h5diff_50.txt index 65b563c..434b458 100644 --- a/tools/h5diff/testfiles/h5diff_50.txt +++ b/tools/h5diff/testfiles/h5diff_50.txt @@ -10,3 +10,4 @@ position dset0a dset0b difference [ 2 0 ] 1 5 4 [ 2 1 ] 1 6 5 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_51.txt b/tools/h5diff/testfiles/h5diff_51.txt index e6402cc..621ba2a 100644 --- a/tools/h5diff/testfiles/h5diff_51.txt +++ b/tools/h5diff/testfiles/h5diff_51.txt @@ -7,3 +7,4 @@ position dset1a dset1b difference [ 2 0 ] 1 5 4 [ 2 1 ] 1 6 5 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_52.txt b/tools/h5diff/testfiles/h5diff_52.txt index 88febb9..6667659 100644 --- a/tools/h5diff/testfiles/h5diff_52.txt +++ b/tools/h5diff/testfiles/h5diff_52.txt @@ -7,3 +7,4 @@ position dset2a dset2b difference [ 2 0 ] 1 5 4 [ 2 1 ] 1 6 5 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_53.txt b/tools/h5diff/testfiles/h5diff_53.txt index 554d71a..458d166 100644 --- a/tools/h5diff/testfiles/h5diff_53.txt +++ b/tools/h5diff/testfiles/h5diff_53.txt @@ -7,3 +7,4 @@ position dset3a dset4b difference [ 2 0 ] 1 5 4 [ 2 1 ] 1 6 5 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_54.txt b/tools/h5diff/testfiles/h5diff_54.txt index 1e8adfd..2ca60f8 100644 --- a/tools/h5diff/testfiles/h5diff_54.txt +++ b/tools/h5diff/testfiles/h5diff_54.txt @@ -7,3 +7,4 @@ position dset4a dset4b difference [ 2 0 ] 1 5 4 [ 2 1 ] 1 6 5 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_55.txt b/tools/h5diff/testfiles/h5diff_55.txt index f895955..1288887 100644 --- a/tools/h5diff/testfiles/h5diff_55.txt +++ b/tools/h5diff/testfiles/h5diff_55.txt @@ -7,3 +7,4 @@ position dset5a dset5b difference [ 2 0 ] 1 5 4 [ 2 1 ] 1 6 5 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_56.txt b/tools/h5diff/testfiles/h5diff_56.txt index 402db43..0e82860 100644 --- a/tools/h5diff/testfiles/h5diff_56.txt +++ b/tools/h5diff/testfiles/h5diff_56.txt @@ -7,3 +7,4 @@ position dset6a dset6b difference [ 2 0 ] 1 5 4 [ 2 1 ] 1 6 5 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_57.txt b/tools/h5diff/testfiles/h5diff_57.txt index a026077..61aaa57 100644 --- a/tools/h5diff/testfiles/h5diff_57.txt +++ b/tools/h5diff/testfiles/h5diff_57.txt @@ -8,3 +8,4 @@ Not comparable: has sign H5T_SGN_2 and has sign H5T_SGN_NONE Some objects are not comparable -------------------------------- Use -c for a list of objects. +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_58.txt b/tools/h5diff/testfiles/h5diff_58.txt index c46cad3..768dd97 100644 --- a/tools/h5diff/testfiles/h5diff_58.txt +++ b/tools/h5diff/testfiles/h5diff_58.txt @@ -8,3 +8,4 @@ point #1 (2,2) (3,3) point #3 (1,6) (2,5) point #4 (2,8) (1,7) 4 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt index 82c5240..f76d4d5 100644 --- a/tools/h5diff/testfiles/h5diff_600.txt +++ b/tools/h5diff/testfiles/h5diff_600.txt @@ -3,64 +3,100 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] file2 File name of the second HDF5 file [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -r, --report Report mode. Print differences - -v, --verbose Verbose mode. Print differences, list of objects - -q, --quiet Quiet mode. Do not do output + -h, --help Print a usage message and exit. + -V, --version Print version number and exit. + -r, --report Report mode. Print differences. + -v, --verbose Verbose mode. Print differences, list of objects. + -q, --quiet Quiet mode. Do not produce output. + --follow-links Follow symbolic links (soft links and external links) + and compare the links' target objects. + If symbolic link(s) with the same name exist in the + files being compared, then determine whether the + target of each link is an existing object (dataset, + group, or named datatype) or the link is a dangling + link (a soft or external link pointing to a target + object that does not yet exist). + - If both symbolic links are dangling links, they + are treated as being the same; by default, h5diff + returns an exit code of 0. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If only one of the two links is a dangling link, + they are treated as being different and h5diff + returns an exit code of 1. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If both symbolic links point to existing objects, + h5diff compares the two objects. + If any symbolic link specified in the call to h5diff + does not exist, h5diff treats it as an error and + returns an exit code of 2. + --no-dangling-links Must be used with --follow-links option; + otherwise, h5diff shows error message and returns + an exit code of 2. + Check for any symbolic links (soft links or external + links) that do not resolve to an existing object + (dataset, group, or named datatype). If any + dangling link is found, this situation is treated as + an error and h5diff returns an exit code of 2. -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection - -n C, --count=C Print differences up to C number, C is a positive integer. - -d D, --delta=D Print difference if (|a-b| > D), D is a positive number. - -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. + -n C, --count=C Print differences up to C number, C is a positive + integer. + -d D, --delta=D Print difference if (|a-b| > D), D is a positive + number. + -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive + number. --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. - If the system epsilon is not defined, use the value below: + where EPSILON (FLT_EPSILON or FLT_EPSILON) is the + system epsilon value. + If the system epsilon is not defined, use the value + below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for comparing floating point values. - By default, strict equality is used. Use -p or -d to set specific tolerance. + -d, -p, and --use-system-epsilon options are used for + comparing floating point values. + By default, strict equality is used. Use -p or -d to + set specific tolerance. Modes of output: - Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output Compare criteria - - If no objects [obj1[obj2]] are specified, h5diff only compares objects - with the same absolute path in both files + If no objects [obj1[obj2]] are specified, h5diff only compares objects + with the same absolute path in both files The compare criteria is: - 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 4) links: name string difference - of the linked value + 1) datasets: numerical array differences + 2) groups: name string difference + 3) datatypes: the return value of H5Tequal + 4) links: name string difference of the linked value as default + (refer to --follow-links option). - Return exit code: - - 1 if differences found, 0 if no differences, 2 if error + Exit code: + 0 if no differences, 1 if differences found, 2 if error Examples of use: - 1) h5diff file1 file2 /g1/dset1 /g1/dset2 - Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2 2) h5diff file1 file2 /g1/dset1 - Compares object '/g1/dset1' in both files 3) h5diff file1 file2 - Compares all objects in both files - Note) file1 and file2 can be the same file. Use - - h5diff file1 file1 /g1/dset1 /g1/dset2 - - to compare '/g1/dset1' and '/g1/dset2' in the same file + Notes: + file1 and file2 can be the same file. + Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare + '/g1/dset1' and '/g1/dset2' in the same file h5diff error: missing file names +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt index e115114..a5286df 100644 --- a/tools/h5diff/testfiles/h5diff_603.txt +++ b/tools/h5diff/testfiles/h5diff_603.txt @@ -4,63 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] file2 File name of the second HDF5 file [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -r, --report Report mode. Print differences - -v, --verbose Verbose mode. Print differences, list of objects - -q, --quiet Quiet mode. Do not do output + -h, --help Print a usage message and exit. + -V, --version Print version number and exit. + -r, --report Report mode. Print differences. + -v, --verbose Verbose mode. Print differences, list of objects. + -q, --quiet Quiet mode. Do not produce output. + --follow-links Follow symbolic links (soft links and external links) + and compare the links' target objects. + If symbolic link(s) with the same name exist in the + files being compared, then determine whether the + target of each link is an existing object (dataset, + group, or named datatype) or the link is a dangling + link (a soft or external link pointing to a target + object that does not yet exist). + - If both symbolic links are dangling links, they + are treated as being the same; by default, h5diff + returns an exit code of 0. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If only one of the two links is a dangling link, + they are treated as being different and h5diff + returns an exit code of 1. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If both symbolic links point to existing objects, + h5diff compares the two objects. + If any symbolic link specified in the call to h5diff + does not exist, h5diff treats it as an error and + returns an exit code of 2. + --no-dangling-links Must be used with --follow-links option; + otherwise, h5diff shows error message and returns + an exit code of 2. + Check for any symbolic links (soft links or external + links) that do not resolve to an existing object + (dataset, group, or named datatype). If any + dangling link is found, this situation is treated as + an error and h5diff returns an exit code of 2. -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection - -n C, --count=C Print differences up to C number, C is a positive integer. - -d D, --delta=D Print difference if (|a-b| > D), D is a positive number. - -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. + -n C, --count=C Print differences up to C number, C is a positive + integer. + -d D, --delta=D Print difference if (|a-b| > D), D is a positive + number. + -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive + number. --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. - If the system epsilon is not defined, use the value below: + where EPSILON (FLT_EPSILON or FLT_EPSILON) is the + system epsilon value. + If the system epsilon is not defined, use the value + below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for comparing floating point values. - By default, strict equality is used. Use -p or -d to set specific tolerance. + -d, -p, and --use-system-epsilon options are used for + comparing floating point values. + By default, strict equality is used. Use -p or -d to + set specific tolerance. Modes of output: - Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output Compare criteria - - If no objects [obj1[obj2]] are specified, h5diff only compares objects - with the same absolute path in both files + If no objects [obj1[obj2]] are specified, h5diff only compares objects + with the same absolute path in both files The compare criteria is: - 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 4) links: name string difference - of the linked value + 1) datasets: numerical array differences + 2) groups: name string difference + 3) datatypes: the return value of H5Tequal + 4) links: name string difference of the linked value as default + (refer to --follow-links option). - Return exit code: - - 1 if differences found, 0 if no differences, 2 if error + Exit code: + 0 if no differences, 1 if differences found, 2 if error Examples of use: - 1) h5diff file1 file2 /g1/dset1 /g1/dset2 - Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2 2) h5diff file1 file2 /g1/dset1 - Compares object '/g1/dset1' in both files 3) h5diff file1 file2 - Compares all objects in both files - Note) file1 and file2 can be the same file. Use - - h5diff file1 file1 /g1/dset1 /g1/dset2 - - to compare '/g1/dset1' and '/g1/dset2' in the same file + Notes: + file1 and file2 can be the same file. + Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare + '/g1/dset1' and '/g1/dset2' in the same file +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_604.txt b/tools/h5diff/testfiles/h5diff_604.txt index 554f2ed..db14532 100644 --- a/tools/h5diff/testfiles/h5diff_604.txt +++ b/tools/h5diff/testfiles/h5diff_604.txt @@ -1,2 +1,3 @@ dataset: and 6 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_605.txt b/tools/h5diff/testfiles/h5diff_605.txt index 554f2ed..db14532 100644 --- a/tools/h5diff/testfiles/h5diff_605.txt +++ b/tools/h5diff/testfiles/h5diff_605.txt @@ -1,2 +1,3 @@ dataset: and 6 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt index db361fd..ab8039e 100644 --- a/tools/h5diff/testfiles/h5diff_606.txt +++ b/tools/h5diff/testfiles/h5diff_606.txt @@ -4,63 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] file2 File name of the second HDF5 file [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -r, --report Report mode. Print differences - -v, --verbose Verbose mode. Print differences, list of objects - -q, --quiet Quiet mode. Do not do output + -h, --help Print a usage message and exit. + -V, --version Print version number and exit. + -r, --report Report mode. Print differences. + -v, --verbose Verbose mode. Print differences, list of objects. + -q, --quiet Quiet mode. Do not produce output. + --follow-links Follow symbolic links (soft links and external links) + and compare the links' target objects. + If symbolic link(s) with the same name exist in the + files being compared, then determine whether the + target of each link is an existing object (dataset, + group, or named datatype) or the link is a dangling + link (a soft or external link pointing to a target + object that does not yet exist). + - If both symbolic links are dangling links, they + are treated as being the same; by default, h5diff + returns an exit code of 0. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If only one of the two links is a dangling link, + they are treated as being different and h5diff + returns an exit code of 1. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If both symbolic links point to existing objects, + h5diff compares the two objects. + If any symbolic link specified in the call to h5diff + does not exist, h5diff treats it as an error and + returns an exit code of 2. + --no-dangling-links Must be used with --follow-links option; + otherwise, h5diff shows error message and returns + an exit code of 2. + Check for any symbolic links (soft links or external + links) that do not resolve to an existing object + (dataset, group, or named datatype). If any + dangling link is found, this situation is treated as + an error and h5diff returns an exit code of 2. -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection - -n C, --count=C Print differences up to C number, C is a positive integer. - -d D, --delta=D Print difference if (|a-b| > D), D is a positive number. - -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. + -n C, --count=C Print differences up to C number, C is a positive + integer. + -d D, --delta=D Print difference if (|a-b| > D), D is a positive + number. + -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive + number. --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. - If the system epsilon is not defined, use the value below: + where EPSILON (FLT_EPSILON or FLT_EPSILON) is the + system epsilon value. + If the system epsilon is not defined, use the value + below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for comparing floating point values. - By default, strict equality is used. Use -p or -d to set specific tolerance. + -d, -p, and --use-system-epsilon options are used for + comparing floating point values. + By default, strict equality is used. Use -p or -d to + set specific tolerance. Modes of output: - Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output Compare criteria - - If no objects [obj1[obj2]] are specified, h5diff only compares objects - with the same absolute path in both files + If no objects [obj1[obj2]] are specified, h5diff only compares objects + with the same absolute path in both files The compare criteria is: - 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 4) links: name string difference - of the linked value + 1) datasets: numerical array differences + 2) groups: name string difference + 3) datatypes: the return value of H5Tequal + 4) links: name string difference of the linked value as default + (refer to --follow-links option). - Return exit code: - - 1 if differences found, 0 if no differences, 2 if error + Exit code: + 0 if no differences, 1 if differences found, 2 if error Examples of use: - 1) h5diff file1 file2 /g1/dset1 /g1/dset2 - Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2 2) h5diff file1 file2 /g1/dset1 - Compares object '/g1/dset1' in both files 3) h5diff file1 file2 - Compares all objects in both files - Note) file1 and file2 can be the same file. Use - - h5diff file1 file1 /g1/dset1 /g1/dset2 - - to compare '/g1/dset1' and '/g1/dset2' in the same file + Notes: + file1 and file2 can be the same file. + Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare + '/g1/dset1' and '/g1/dset2' in the same file +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_607.txt b/tools/h5diff/testfiles/h5diff_607.txt index 554f2ed..db14532 100644 --- a/tools/h5diff/testfiles/h5diff_607.txt +++ b/tools/h5diff/testfiles/h5diff_607.txt @@ -1,2 +1,3 @@ dataset: and 6 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_608.txt b/tools/h5diff/testfiles/h5diff_608.txt index 554f2ed..db14532 100644 --- a/tools/h5diff/testfiles/h5diff_608.txt +++ b/tools/h5diff/testfiles/h5diff_608.txt @@ -1,2 +1,3 @@ dataset: and 6 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_609.txt b/tools/h5diff/testfiles/h5diff_609.txt index e69de29..eca5994 100644 --- a/tools/h5diff/testfiles/h5diff_609.txt +++ b/tools/h5diff/testfiles/h5diff_609.txt @@ -0,0 +1 @@ +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_610.txt b/tools/h5diff/testfiles/h5diff_610.txt index 554f2ed..db14532 100644 --- a/tools/h5diff/testfiles/h5diff_610.txt +++ b/tools/h5diff/testfiles/h5diff_610.txt @@ -1,2 +1,3 @@ dataset: and 6 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt index bbd6b00..686ff15 100644 --- a/tools/h5diff/testfiles/h5diff_612.txt +++ b/tools/h5diff/testfiles/h5diff_612.txt @@ -4,63 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] file2 File name of the second HDF5 file [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -r, --report Report mode. Print differences - -v, --verbose Verbose mode. Print differences, list of objects - -q, --quiet Quiet mode. Do not do output + -h, --help Print a usage message and exit. + -V, --version Print version number and exit. + -r, --report Report mode. Print differences. + -v, --verbose Verbose mode. Print differences, list of objects. + -q, --quiet Quiet mode. Do not produce output. + --follow-links Follow symbolic links (soft links and external links) + and compare the links' target objects. + If symbolic link(s) with the same name exist in the + files being compared, then determine whether the + target of each link is an existing object (dataset, + group, or named datatype) or the link is a dangling + link (a soft or external link pointing to a target + object that does not yet exist). + - If both symbolic links are dangling links, they + are treated as being the same; by default, h5diff + returns an exit code of 0. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If only one of the two links is a dangling link, + they are treated as being different and h5diff + returns an exit code of 1. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If both symbolic links point to existing objects, + h5diff compares the two objects. + If any symbolic link specified in the call to h5diff + does not exist, h5diff treats it as an error and + returns an exit code of 2. + --no-dangling-links Must be used with --follow-links option; + otherwise, h5diff shows error message and returns + an exit code of 2. + Check for any symbolic links (soft links or external + links) that do not resolve to an existing object + (dataset, group, or named datatype). If any + dangling link is found, this situation is treated as + an error and h5diff returns an exit code of 2. -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection - -n C, --count=C Print differences up to C number, C is a positive integer. - -d D, --delta=D Print difference if (|a-b| > D), D is a positive number. - -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. + -n C, --count=C Print differences up to C number, C is a positive + integer. + -d D, --delta=D Print difference if (|a-b| > D), D is a positive + number. + -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive + number. --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. - If the system epsilon is not defined, use the value below: + where EPSILON (FLT_EPSILON or FLT_EPSILON) is the + system epsilon value. + If the system epsilon is not defined, use the value + below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for comparing floating point values. - By default, strict equality is used. Use -p or -d to set specific tolerance. + -d, -p, and --use-system-epsilon options are used for + comparing floating point values. + By default, strict equality is used. Use -p or -d to + set specific tolerance. Modes of output: - Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output Compare criteria - - If no objects [obj1[obj2]] are specified, h5diff only compares objects - with the same absolute path in both files + If no objects [obj1[obj2]] are specified, h5diff only compares objects + with the same absolute path in both files The compare criteria is: - 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 4) links: name string difference - of the linked value + 1) datasets: numerical array differences + 2) groups: name string difference + 3) datatypes: the return value of H5Tequal + 4) links: name string difference of the linked value as default + (refer to --follow-links option). - Return exit code: - - 1 if differences found, 0 if no differences, 2 if error + Exit code: + 0 if no differences, 1 if differences found, 2 if error Examples of use: - 1) h5diff file1 file2 /g1/dset1 /g1/dset2 - Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2 2) h5diff file1 file2 /g1/dset1 - Compares object '/g1/dset1' in both files 3) h5diff file1 file2 - Compares all objects in both files - Note) file1 and file2 can be the same file. Use - - h5diff file1 file1 /g1/dset1 /g1/dset2 - - to compare '/g1/dset1' and '/g1/dset2' in the same file + Notes: + file1 and file2 can be the same file. + Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare + '/g1/dset1' and '/g1/dset2' in the same file +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_613.txt b/tools/h5diff/testfiles/h5diff_613.txt index 554f2ed..db14532 100644 --- a/tools/h5diff/testfiles/h5diff_613.txt +++ b/tools/h5diff/testfiles/h5diff_613.txt @@ -1,2 +1,3 @@ dataset: and 6 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_614.txt b/tools/h5diff/testfiles/h5diff_614.txt index 554f2ed..db14532 100644 --- a/tools/h5diff/testfiles/h5diff_614.txt +++ b/tools/h5diff/testfiles/h5diff_614.txt @@ -1,2 +1,3 @@ dataset: and 6 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt index 9c8f0c7..cf779c5 100644 --- a/tools/h5diff/testfiles/h5diff_615.txt +++ b/tools/h5diff/testfiles/h5diff_615.txt @@ -4,63 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] file2 File name of the second HDF5 file [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -r, --report Report mode. Print differences - -v, --verbose Verbose mode. Print differences, list of objects - -q, --quiet Quiet mode. Do not do output + -h, --help Print a usage message and exit. + -V, --version Print version number and exit. + -r, --report Report mode. Print differences. + -v, --verbose Verbose mode. Print differences, list of objects. + -q, --quiet Quiet mode. Do not produce output. + --follow-links Follow symbolic links (soft links and external links) + and compare the links' target objects. + If symbolic link(s) with the same name exist in the + files being compared, then determine whether the + target of each link is an existing object (dataset, + group, or named datatype) or the link is a dangling + link (a soft or external link pointing to a target + object that does not yet exist). + - If both symbolic links are dangling links, they + are treated as being the same; by default, h5diff + returns an exit code of 0. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If only one of the two links is a dangling link, + they are treated as being different and h5diff + returns an exit code of 1. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If both symbolic links point to existing objects, + h5diff compares the two objects. + If any symbolic link specified in the call to h5diff + does not exist, h5diff treats it as an error and + returns an exit code of 2. + --no-dangling-links Must be used with --follow-links option; + otherwise, h5diff shows error message and returns + an exit code of 2. + Check for any symbolic links (soft links or external + links) that do not resolve to an existing object + (dataset, group, or named datatype). If any + dangling link is found, this situation is treated as + an error and h5diff returns an exit code of 2. -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection - -n C, --count=C Print differences up to C number, C is a positive integer. - -d D, --delta=D Print difference if (|a-b| > D), D is a positive number. - -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. + -n C, --count=C Print differences up to C number, C is a positive + integer. + -d D, --delta=D Print difference if (|a-b| > D), D is a positive + number. + -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive + number. --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. - If the system epsilon is not defined, use the value below: + where EPSILON (FLT_EPSILON or FLT_EPSILON) is the + system epsilon value. + If the system epsilon is not defined, use the value + below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for comparing floating point values. - By default, strict equality is used. Use -p or -d to set specific tolerance. + -d, -p, and --use-system-epsilon options are used for + comparing floating point values. + By default, strict equality is used. Use -p or -d to + set specific tolerance. Modes of output: - Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output Compare criteria - - If no objects [obj1[obj2]] are specified, h5diff only compares objects - with the same absolute path in both files + If no objects [obj1[obj2]] are specified, h5diff only compares objects + with the same absolute path in both files The compare criteria is: - 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 4) links: name string difference - of the linked value + 1) datasets: numerical array differences + 2) groups: name string difference + 3) datatypes: the return value of H5Tequal + 4) links: name string difference of the linked value as default + (refer to --follow-links option). - Return exit code: - - 1 if differences found, 0 if no differences, 2 if error + Exit code: + 0 if no differences, 1 if differences found, 2 if error Examples of use: - 1) h5diff file1 file2 /g1/dset1 /g1/dset2 - Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2 2) h5diff file1 file2 /g1/dset1 - Compares object '/g1/dset1' in both files 3) h5diff file1 file2 - Compares all objects in both files - Note) file1 and file2 can be the same file. Use - - h5diff file1 file1 /g1/dset1 /g1/dset2 - - to compare '/g1/dset1' and '/g1/dset2' in the same file + Notes: + file1 and file2 can be the same file. + Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare + '/g1/dset1' and '/g1/dset2' in the same file +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_616.txt b/tools/h5diff/testfiles/h5diff_616.txt index 47a1364..3bc194a 100644 --- a/tools/h5diff/testfiles/h5diff_616.txt +++ b/tools/h5diff/testfiles/h5diff_616.txt @@ -1,2 +1,3 @@ dataset: and 2 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_617.txt b/tools/h5diff/testfiles/h5diff_617.txt index 47a1364..3bc194a 100644 --- a/tools/h5diff/testfiles/h5diff_617.txt +++ b/tools/h5diff/testfiles/h5diff_617.txt @@ -1,2 +1,3 @@ dataset: and 2 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_618.txt b/tools/h5diff/testfiles/h5diff_618.txt index e69de29..eca5994 100644 --- a/tools/h5diff/testfiles/h5diff_618.txt +++ b/tools/h5diff/testfiles/h5diff_618.txt @@ -0,0 +1 @@ +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_619.txt b/tools/h5diff/testfiles/h5diff_619.txt index 554f2ed..db14532 100644 --- a/tools/h5diff/testfiles/h5diff_619.txt +++ b/tools/h5diff/testfiles/h5diff_619.txt @@ -1,2 +1,3 @@ dataset: and 6 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt index 79eebed..041bb7b 100644 --- a/tools/h5diff/testfiles/h5diff_621.txt +++ b/tools/h5diff/testfiles/h5diff_621.txt @@ -4,63 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] file2 File name of the second HDF5 file [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -r, --report Report mode. Print differences - -v, --verbose Verbose mode. Print differences, list of objects - -q, --quiet Quiet mode. Do not do output + -h, --help Print a usage message and exit. + -V, --version Print version number and exit. + -r, --report Report mode. Print differences. + -v, --verbose Verbose mode. Print differences, list of objects. + -q, --quiet Quiet mode. Do not produce output. + --follow-links Follow symbolic links (soft links and external links) + and compare the links' target objects. + If symbolic link(s) with the same name exist in the + files being compared, then determine whether the + target of each link is an existing object (dataset, + group, or named datatype) or the link is a dangling + link (a soft or external link pointing to a target + object that does not yet exist). + - If both symbolic links are dangling links, they + are treated as being the same; by default, h5diff + returns an exit code of 0. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If only one of the two links is a dangling link, + they are treated as being different and h5diff + returns an exit code of 1. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If both symbolic links point to existing objects, + h5diff compares the two objects. + If any symbolic link specified in the call to h5diff + does not exist, h5diff treats it as an error and + returns an exit code of 2. + --no-dangling-links Must be used with --follow-links option; + otherwise, h5diff shows error message and returns + an exit code of 2. + Check for any symbolic links (soft links or external + links) that do not resolve to an existing object + (dataset, group, or named datatype). If any + dangling link is found, this situation is treated as + an error and h5diff returns an exit code of 2. -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection - -n C, --count=C Print differences up to C number, C is a positive integer. - -d D, --delta=D Print difference if (|a-b| > D), D is a positive number. - -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. + -n C, --count=C Print differences up to C number, C is a positive + integer. + -d D, --delta=D Print difference if (|a-b| > D), D is a positive + number. + -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive + number. --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. - If the system epsilon is not defined, use the value below: + where EPSILON (FLT_EPSILON or FLT_EPSILON) is the + system epsilon value. + If the system epsilon is not defined, use the value + below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for comparing floating point values. - By default, strict equality is used. Use -p or -d to set specific tolerance. + -d, -p, and --use-system-epsilon options are used for + comparing floating point values. + By default, strict equality is used. Use -p or -d to + set specific tolerance. Modes of output: - Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output Compare criteria - - If no objects [obj1[obj2]] are specified, h5diff only compares objects - with the same absolute path in both files + If no objects [obj1[obj2]] are specified, h5diff only compares objects + with the same absolute path in both files The compare criteria is: - 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 4) links: name string difference - of the linked value + 1) datasets: numerical array differences + 2) groups: name string difference + 3) datatypes: the return value of H5Tequal + 4) links: name string difference of the linked value as default + (refer to --follow-links option). - Return exit code: - - 1 if differences found, 0 if no differences, 2 if error + Exit code: + 0 if no differences, 1 if differences found, 2 if error Examples of use: - 1) h5diff file1 file2 /g1/dset1 /g1/dset2 - Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2 2) h5diff file1 file2 /g1/dset1 - Compares object '/g1/dset1' in both files 3) h5diff file1 file2 - Compares all objects in both files - Note) file1 and file2 can be the same file. Use - - h5diff file1 file1 /g1/dset1 /g1/dset2 - - to compare '/g1/dset1' and '/g1/dset2' in the same file + Notes: + file1 and file2 can be the same file. + Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare + '/g1/dset1' and '/g1/dset2' in the same file +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt index 09de51d..923bab5 100644 --- a/tools/h5diff/testfiles/h5diff_622.txt +++ b/tools/h5diff/testfiles/h5diff_622.txt @@ -4,63 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] file2 File name of the second HDF5 file [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -r, --report Report mode. Print differences - -v, --verbose Verbose mode. Print differences, list of objects - -q, --quiet Quiet mode. Do not do output + -h, --help Print a usage message and exit. + -V, --version Print version number and exit. + -r, --report Report mode. Print differences. + -v, --verbose Verbose mode. Print differences, list of objects. + -q, --quiet Quiet mode. Do not produce output. + --follow-links Follow symbolic links (soft links and external links) + and compare the links' target objects. + If symbolic link(s) with the same name exist in the + files being compared, then determine whether the + target of each link is an existing object (dataset, + group, or named datatype) or the link is a dangling + link (a soft or external link pointing to a target + object that does not yet exist). + - If both symbolic links are dangling links, they + are treated as being the same; by default, h5diff + returns an exit code of 0. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If only one of the two links is a dangling link, + they are treated as being different and h5diff + returns an exit code of 1. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If both symbolic links point to existing objects, + h5diff compares the two objects. + If any symbolic link specified in the call to h5diff + does not exist, h5diff treats it as an error and + returns an exit code of 2. + --no-dangling-links Must be used with --follow-links option; + otherwise, h5diff shows error message and returns + an exit code of 2. + Check for any symbolic links (soft links or external + links) that do not resolve to an existing object + (dataset, group, or named datatype). If any + dangling link is found, this situation is treated as + an error and h5diff returns an exit code of 2. -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection - -n C, --count=C Print differences up to C number, C is a positive integer. - -d D, --delta=D Print difference if (|a-b| > D), D is a positive number. - -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. + -n C, --count=C Print differences up to C number, C is a positive + integer. + -d D, --delta=D Print difference if (|a-b| > D), D is a positive + number. + -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive + number. --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. - If the system epsilon is not defined, use the value below: + where EPSILON (FLT_EPSILON or FLT_EPSILON) is the + system epsilon value. + If the system epsilon is not defined, use the value + below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for comparing floating point values. - By default, strict equality is used. Use -p or -d to set specific tolerance. + -d, -p, and --use-system-epsilon options are used for + comparing floating point values. + By default, strict equality is used. Use -p or -d to + set specific tolerance. Modes of output: - Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output Compare criteria - - If no objects [obj1[obj2]] are specified, h5diff only compares objects - with the same absolute path in both files + If no objects [obj1[obj2]] are specified, h5diff only compares objects + with the same absolute path in both files The compare criteria is: - 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 4) links: name string difference - of the linked value + 1) datasets: numerical array differences + 2) groups: name string difference + 3) datatypes: the return value of H5Tequal + 4) links: name string difference of the linked value as default + (refer to --follow-links option). - Return exit code: - - 1 if differences found, 0 if no differences, 2 if error + Exit code: + 0 if no differences, 1 if differences found, 2 if error Examples of use: - 1) h5diff file1 file2 /g1/dset1 /g1/dset2 - Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2 2) h5diff file1 file2 /g1/dset1 - Compares object '/g1/dset1' in both files 3) h5diff file1 file2 - Compares all objects in both files - Note) file1 and file2 can be the same file. Use - - h5diff file1 file1 /g1/dset1 /g1/dset2 - - to compare '/g1/dset1' and '/g1/dset2' in the same file + Notes: + file1 and file2 can be the same file. + Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare + '/g1/dset1' and '/g1/dset2' in the same file +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt index dc60b94..405a211 100644 --- a/tools/h5diff/testfiles/h5diff_623.txt +++ b/tools/h5diff/testfiles/h5diff_623.txt @@ -4,63 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] file2 File name of the second HDF5 file [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -r, --report Report mode. Print differences - -v, --verbose Verbose mode. Print differences, list of objects - -q, --quiet Quiet mode. Do not do output + -h, --help Print a usage message and exit. + -V, --version Print version number and exit. + -r, --report Report mode. Print differences. + -v, --verbose Verbose mode. Print differences, list of objects. + -q, --quiet Quiet mode. Do not produce output. + --follow-links Follow symbolic links (soft links and external links) + and compare the links' target objects. + If symbolic link(s) with the same name exist in the + files being compared, then determine whether the + target of each link is an existing object (dataset, + group, or named datatype) or the link is a dangling + link (a soft or external link pointing to a target + object that does not yet exist). + - If both symbolic links are dangling links, they + are treated as being the same; by default, h5diff + returns an exit code of 0. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If only one of the two links is a dangling link, + they are treated as being different and h5diff + returns an exit code of 1. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If both symbolic links point to existing objects, + h5diff compares the two objects. + If any symbolic link specified in the call to h5diff + does not exist, h5diff treats it as an error and + returns an exit code of 2. + --no-dangling-links Must be used with --follow-links option; + otherwise, h5diff shows error message and returns + an exit code of 2. + Check for any symbolic links (soft links or external + links) that do not resolve to an existing object + (dataset, group, or named datatype). If any + dangling link is found, this situation is treated as + an error and h5diff returns an exit code of 2. -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection - -n C, --count=C Print differences up to C number, C is a positive integer. - -d D, --delta=D Print difference if (|a-b| > D), D is a positive number. - -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. + -n C, --count=C Print differences up to C number, C is a positive + integer. + -d D, --delta=D Print difference if (|a-b| > D), D is a positive + number. + -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive + number. --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. - If the system epsilon is not defined, use the value below: + where EPSILON (FLT_EPSILON or FLT_EPSILON) is the + system epsilon value. + If the system epsilon is not defined, use the value + below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for comparing floating point values. - By default, strict equality is used. Use -p or -d to set specific tolerance. + -d, -p, and --use-system-epsilon options are used for + comparing floating point values. + By default, strict equality is used. Use -p or -d to + set specific tolerance. Modes of output: - Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output Compare criteria - - If no objects [obj1[obj2]] are specified, h5diff only compares objects - with the same absolute path in both files + If no objects [obj1[obj2]] are specified, h5diff only compares objects + with the same absolute path in both files The compare criteria is: - 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 4) links: name string difference - of the linked value + 1) datasets: numerical array differences + 2) groups: name string difference + 3) datatypes: the return value of H5Tequal + 4) links: name string difference of the linked value as default + (refer to --follow-links option). - Return exit code: - - 1 if differences found, 0 if no differences, 2 if error + Exit code: + 0 if no differences, 1 if differences found, 2 if error Examples of use: - 1) h5diff file1 file2 /g1/dset1 /g1/dset2 - Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2 2) h5diff file1 file2 /g1/dset1 - Compares object '/g1/dset1' in both files 3) h5diff file1 file2 - Compares all objects in both files - Note) file1 and file2 can be the same file. Use - - h5diff file1 file1 /g1/dset1 /g1/dset2 - - to compare '/g1/dset1' and '/g1/dset2' in the same file + Notes: + file1 and file2 can be the same file. + Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare + '/g1/dset1' and '/g1/dset2' in the same file +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt index 016ab77..dc7c83b 100644 --- a/tools/h5diff/testfiles/h5diff_624.txt +++ b/tools/h5diff/testfiles/h5diff_624.txt @@ -4,63 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] file2 File name of the second HDF5 file [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -r, --report Report mode. Print differences - -v, --verbose Verbose mode. Print differences, list of objects - -q, --quiet Quiet mode. Do not do output + -h, --help Print a usage message and exit. + -V, --version Print version number and exit. + -r, --report Report mode. Print differences. + -v, --verbose Verbose mode. Print differences, list of objects. + -q, --quiet Quiet mode. Do not produce output. + --follow-links Follow symbolic links (soft links and external links) + and compare the links' target objects. + If symbolic link(s) with the same name exist in the + files being compared, then determine whether the + target of each link is an existing object (dataset, + group, or named datatype) or the link is a dangling + link (a soft or external link pointing to a target + object that does not yet exist). + - If both symbolic links are dangling links, they + are treated as being the same; by default, h5diff + returns an exit code of 0. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If only one of the two links is a dangling link, + they are treated as being different and h5diff + returns an exit code of 1. If, however, + --no-dangling-links is used with --follow-links, + this situation is treated as an error and h5diff + returns an exit code of 2. + - If both symbolic links point to existing objects, + h5diff compares the two objects. + If any symbolic link specified in the call to h5diff + does not exist, h5diff treats it as an error and + returns an exit code of 2. + --no-dangling-links Must be used with --follow-links option; + otherwise, h5diff shows error message and returns + an exit code of 2. + Check for any symbolic links (soft links or external + links) that do not resolve to an existing object + (dataset, group, or named datatype). If any + dangling link is found, this situation is treated as + an error and h5diff returns an exit code of 2. -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection - -n C, --count=C Print differences up to C number, C is a positive integer. - -d D, --delta=D Print difference if (|a-b| > D), D is a positive number. - -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number. + -n C, --count=C Print differences up to C number, C is a positive + integer. + -d D, --delta=D Print difference if (|a-b| > D), D is a positive + number. + -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive + number. --use-system-epsilon Print difference if (|a-b| > EPSILON), - where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. - If the system epsilon is not defined, use the value below: + where EPSILON (FLT_EPSILON or FLT_EPSILON) is the + system epsilon value. + If the system epsilon is not defined, use the value + below: FLT_EPSILON = 1.19209E-07 for float DBL_EPSILON = 2.22045E-16 for double - -d, -p, and --use-system-epsilon options are used for comparing floating point values. - By default, strict equality is used. Use -p or -d to set specific tolerance. + -d, -p, and --use-system-epsilon options are used for + comparing floating point values. + By default, strict equality is used. Use -p or -d to + set specific tolerance. Modes of output: - Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output Compare criteria - - If no objects [obj1[obj2]] are specified, h5diff only compares objects - with the same absolute path in both files + If no objects [obj1[obj2]] are specified, h5diff only compares objects + with the same absolute path in both files The compare criteria is: - 1) datasets: numerical array differences 2) groups: name string difference - 3) datatypes: the return value of H5Tequal 4) links: name string difference - of the linked value + 1) datasets: numerical array differences + 2) groups: name string difference + 3) datatypes: the return value of H5Tequal + 4) links: name string difference of the linked value as default + (refer to --follow-links option). - Return exit code: - - 1 if differences found, 0 if no differences, 2 if error + Exit code: + 0 if no differences, 1 if differences found, 2 if error Examples of use: - 1) h5diff file1 file2 /g1/dset1 /g1/dset2 - Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2 2) h5diff file1 file2 /g1/dset1 - Compares object '/g1/dset1' in both files 3) h5diff file1 file2 - Compares all objects in both files - Note) file1 and file2 can be the same file. Use - - h5diff file1 file1 /g1/dset1 /g1/dset2 - - to compare '/g1/dset1' and '/g1/dset2' in the same file + Notes: + file1 and file2 can be the same file. + Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare + '/g1/dset1' and '/g1/dset2' in the same file +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_625.txt b/tools/h5diff/testfiles/h5diff_625.txt index 47a1364..3bc194a 100644 --- a/tools/h5diff/testfiles/h5diff_625.txt +++ b/tools/h5diff/testfiles/h5diff_625.txt @@ -1,2 +1,3 @@ dataset: and 2 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_626.txt b/tools/h5diff/testfiles/h5diff_626.txt index be392ae..6494066 100644 --- a/tools/h5diff/testfiles/h5diff_626.txt +++ b/tools/h5diff/testfiles/h5diff_626.txt @@ -1,2 +1,3 @@ dataset: and 3 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_627.txt b/tools/h5diff/testfiles/h5diff_627.txt index 554f2ed..db14532 100644 --- a/tools/h5diff/testfiles/h5diff_627.txt +++ b/tools/h5diff/testfiles/h5diff_627.txt @@ -1,2 +1,3 @@ dataset: and 6 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_628.txt b/tools/h5diff/testfiles/h5diff_628.txt index 74decda..e11d8ee 100644 --- a/tools/h5diff/testfiles/h5diff_628.txt +++ b/tools/h5diff/testfiles/h5diff_628.txt @@ -1,2 +1,3 @@ dataset: and 1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_629.txt b/tools/h5diff/testfiles/h5diff_629.txt index 4e67f57..7b9b2d8 100644 --- a/tools/h5diff/testfiles/h5diff_629.txt +++ b/tools/h5diff/testfiles/h5diff_629.txt @@ -1 +1,2 @@ h5diff: : unable to open file +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_70.txt b/tools/h5diff/testfiles/h5diff_70.txt index 30dbefe..7abcddd 100644 --- a/tools/h5diff/testfiles/h5diff_70.txt +++ b/tools/h5diff/testfiles/h5diff_70.txt @@ -2029,3 +2029,4 @@ position float3D of float3D of difference Some objects are not comparable -------------------------------- Use -c for a list of objects. +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_80.txt b/tools/h5diff/testfiles/h5diff_80.txt index 33090df..1c55b1a 100644 --- a/tools/h5diff/testfiles/h5diff_80.txt +++ b/tools/h5diff/testfiles/h5diff_80.txt @@ -878,3 +878,4 @@ point #4 (2,8) (1,7) Some objects are not comparable -------------------------------- Use -c for a list of objects. +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_90.txt b/tools/h5diff/testfiles/h5diff_90.txt index e6bfa14..fb23843 100644 --- a/tools/h5diff/testfiles/h5diff_90.txt +++ b/tools/h5diff/testfiles/h5diff_90.txt @@ -53,3 +53,4 @@ Not comparable: or is an empty dataset Some objects are not comparable -------------------------------- Use -c for a list of objects. +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_danglelinks1.h5 b/tools/h5diff/testfiles/h5diff_danglelinks1.h5 new file mode 100644 index 0000000..8cbaac1 Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_danglelinks1.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_danglelinks2.h5 b/tools/h5diff/testfiles/h5diff_danglelinks2.h5 new file mode 100644 index 0000000..f634210 Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_danglelinks2.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 b/tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 new file mode 100644 index 0000000..50b7d2b Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 b/tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 new file mode 100644 index 0000000..610e890 Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_extlink_src.h5 b/tools/h5diff/testfiles/h5diff_extlink_src.h5 new file mode 100644 index 0000000..cfc1066 Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_extlink_src.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_extlink_trg.h5 b/tools/h5diff/testfiles/h5diff_extlink_trg.h5 new file mode 100644 index 0000000..3a322c9 Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_extlink_trg.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_linked_softlink.h5 b/tools/h5diff/testfiles/h5diff_linked_softlink.h5 new file mode 100644 index 0000000..03c5dee Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_linked_softlink.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_softlinks.h5 b/tools/h5diff/testfiles/h5diff_softlinks.h5 new file mode 100644 index 0000000..67a843d Binary files /dev/null and b/tools/h5diff/testfiles/h5diff_softlinks.h5 differ diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index c5bfdc9..373fbfe 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -23,40 +23,37 @@ # Pedro Vicente Nunes: # 10/25/2005: Added test #9 # 11/27/2006: Added test #10, #11 +# Jonathan Kim: +# Improved to use single line +# Improved to check exit code (only serial mode, not necessary for parallel) +# Added test 400 - 425 (links with --follow-links option) +# Added test 450 - 459 (dangling links) ############################################################################### ## test file names ############################################################################### -INDIR=$srcdir/testfiles - -SRCFILE1=h5diff_basic1.h5 -SRCFILE2=h5diff_basic2.h5 -SRCFILE3=h5diff_types.h5 -SRCFILE4=h5diff_dtypes.h5 -SRCFILE5=h5diff_attr1.h5 -SRCFILE6=h5diff_attr2.h5 -SRCFILE7=h5diff_dset1.h5 -SRCFILE8=h5diff_dset2.h5 -SRCFILE9=h5diff_hyper1.h5 -SRCFILE10=h5diff_hyper2.h5 -SRCFILE11=h5diff_empty.h5 -SRCFILE12=h5diff_links.h5 - -FILE1="$INDIR/$SRCFILE1" -FILE2="$INDIR/$SRCFILE2" -FILE3="$INDIR/$SRCFILE3" -FILE4="$INDIR/$SRCFILE4" -FILE5="$INDIR/$SRCFILE5" -FILE6="$INDIR/$SRCFILE6" -FILE7="$INDIR/$SRCFILE7" -FILE8="$INDIR/$SRCFILE8" -FILE9="$INDIR/$SRCFILE9" -FILE10="$INDIR/$SRCFILE10" -FILE11="$INDIR/$SRCFILE11" -FILE12="$INDIR/$SRCFILE12" - +FILE1=h5diff_basic1.h5 +FILE2=h5diff_basic2.h5 +FILE3=h5diff_types.h5 +FILE4=h5diff_dtypes.h5 +FILE5=h5diff_attr1.h5 +FILE6=h5diff_attr2.h5 +FILE7=h5diff_dset1.h5 +FILE8=h5diff_dset2.h5 +FILE9=h5diff_hyper1.h5 +FILE10=h5diff_hyper2.h5 +FILE11=h5diff_empty.h5 +FILE12=h5diff_links.h5 +FILE13=h5diff_softlinks.h5 +FILE14=h5diff_linked_softlink.h5 +FILE15=h5diff_extlink_src.h5 +FILE16=h5diff_extlink_trg.h5 +FILE17=h5diff_ext2softlink_src.h5 +FILE18=h5diff_ext2softlink_trg.h5 +DANGLE_LINK_FILE1=h5diff_danglelinks1.h5 +DANGLE_LINK_FILE2=h5diff_danglelinks2.h5 TESTNAME=h5diff EXIT_SUCCESS=0 @@ -202,45 +199,58 @@ TOOLTEST() { actual_err_sav=${actual_err}-sav shift if test -n "$pmode"; then - RUNCMD=$RUNPARALLEL + RUNCMD=$RUNPARALLEL else - RUNCMD=$RUNSERIAL + RUNCMD=$RUNSERIAL fi # Run test. + TESTING $H5DIFF $@ ( #echo "#############################" #echo "Expected output for '$H5DIFF $@'" #echo "#############################" - #cd $srcdir/testfiles + cd $srcdir/testfiles eval $RUNCMD $H5DIFF_BIN "$@" ) >$actual 2>$actual_err + EXIT_CODE=$? # save actual and actual_err in case they are needed later. cp $actual $actual_sav STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err cat $actual_err >> $actual + # don't add exit code check in pmode, as it causes failure. (exit code + # is from mpirun not tool) + # if any problem occurs relate to an exit code, it will be caught in + # serial mode, so the test is fullfilled. + if test -z "$pmode"; then + echo "EXIT CODE: $EXIT_CODE" >> $actual + fi if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. + # Create the expect file if it doesn't yet exist. echo " CREATED" - cp $actual $expect + cp $actual $expect elif $CMP $expect $actual; then - echo " PASSED" + echo " PASSED" elif test -z "$pmode"; then - echo "*FAILED*" - echo " Expected result ($expect) differs from actual result ($actual)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result ($expect) differs from actual result ($actual)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' else - # parallel mode output are often of different ordering from serial - # output. If the sorted expected and actual files compare the same, - # it is safe to assume the actual output match the expected file. - expect_sorted=expect_sorted - actual_sorted=actual_sorted - sort $expect -o $expect_sorted - sort $actual -o $actual_sorted + # parallel mode output are often of different ordering from serial + # output. If the sorted expected and actual files compare the same, + # it is safe to assume the actual output match the expected file. + expect_sorted=expect_sorted + actual_sorted=actual_sorted + sort $expect -o $expect_sorted + sort $actual -o $actual_sorted + # remove "EXIT CODE:" line from expect file. test for exit code + # is done by serial mode. + grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit + mv $expect_sorted.noexit $expect_sorted if $CMP $expect_sorted $actual_sorted; then echo " PASSED" else @@ -261,8 +271,8 @@ TOOLTEST() { # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav - rm -f $actual_sorted $expect_sorted + rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual_sorted $expect_sorted fi } @@ -274,6 +284,7 @@ SKIP() { } + ############################################################################## # The tests # To avoid the printing of the complete full path of the test file, that hides @@ -288,57 +299,46 @@ SKIP() { # 1.0 -TESTING $H5DIFF -h TOOLTEST h5diff_10.txt -h # 1.1 normal mode -TESTING $H5DIFF $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_11.txt $FILE1 $FILE2 # 1.2 normal mode with objects -TESTING $H5DIFF $SRCFILE1 $SRCFILE2 g1/dset1 g1/dset2 TOOLTEST h5diff_12.txt $FILE1 $FILE2 g1/dset1 g1/dset2 # 1.3 report mode -TESTING $H5DIFF -r $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_13.txt -r $FILE1 $FILE2 # 1.4 report mode with objects -TESTING $H5DIFF -r $SRCFILE1 $SRCFILE2 g1/dset1 g1/dset2 TOOLTEST h5diff_14.txt -r $FILE1 $FILE2 g1/dset1 g1/dset2 # 1.5 with -d -TESTING $H5DIFF --report --delta=5 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_15.txt --report --delta=5 $FILE1 $FILE2 g1/dset3 g1/dset4 # 1.6.1 with -p (int) -TESTING $H5DIFF -v -p 0.02 $SRCFILE1 $SRCFILE1 g1/dset5 g1/dset6 TOOLTEST h5diff_16_1.txt -v -p 0.02 $FILE1 $FILE1 g1/dset5 g1/dset6 # 1.6.2 with -p (unsigned long_long) -TESTING $H5DIFF --verbose --relative=0.02 $SRCFILE1 $SRCFILE1 g1/dset7 g1/dset8 TOOLTEST h5diff_16_2.txt --verbose --relative=0.02 $FILE1 $FILE1 g1/dset7 g1/dset8 # 1.6.3 with -p (double) -TESTING $H5DIFF -v -p 0.02 $SRCFILE1 $SRCFILE1 g1/dset9 g1/dset10 TOOLTEST h5diff_16_3.txt -v -p 0.02 $FILE1 $FILE1 g1/dset9 g1/dset10 # 1.7 verbose mode -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_17.txt -v $FILE1 $FILE2 -# 1.8 test 32-bit INFINITY -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE1 /g1/fp19 -TOOLTEST h5diff_171.txt -v $SRCFILE1 $SRCFILE1 /g1/fp19 +# 1.7 test 32-bit INFINITY +TOOLTEST h5diff_171.txt -v $FILE1 $FILE1 /g1/fp19 -# 1.8 test 64-bit INFINITY -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE1 /g1/fp20 -TOOLTEST h5diff_172.txt -v $SRCFILE1 $SRCFILE1 /g1/fp20 +# 1.7 test 64-bit INFINITY +TOOLTEST h5diff_172.txt -v $FILE1 $FILE1 /g1/fp20 # 1.8 quiet mode -TESTING $H5DIFF -q $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_18.txt -q $FILE1 $FILE2 +# 1.8 -v and -q +TOOLTEST h5diff_18_1.txt -v -q $FILE1 $FILE2 # ############################################################################## @@ -346,15 +346,12 @@ TOOLTEST h5diff_18.txt -q $FILE1 $FILE2 # ############################################################################## # 2.0 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 dset g1 TOOLTEST h5diff_20.txt -v $FILE3 $FILE3 dset g1 # 2.1 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 dset l1 TOOLTEST h5diff_21.txt -v $FILE3 $FILE3 dset l1 # 2.2 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 dset t1 TOOLTEST h5diff_22.txt -v $FILE3 $FILE3 dset t1 # ############################################################################## @@ -362,27 +359,21 @@ TOOLTEST h5diff_22.txt -v $FILE3 $FILE3 dset t1 # ############################################################################## # 2.3 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 g1 g1 TOOLTEST h5diff_23.txt -v $FILE3 $FILE3 g1 g1 # 2.4 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 t1 t1 TOOLTEST h5diff_24.txt -v $FILE3 $FILE3 t1 t1 # 2.5 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 l1 l1 TOOLTEST h5diff_25.txt -v $FILE3 $FILE3 l1 l1 # 2.6 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 g1 g2 TOOLTEST h5diff_26.txt -v $FILE3 $FILE3 g1 g2 # 2.7 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 t1 t2 TOOLTEST h5diff_27.txt -v $FILE3 $FILE3 t1 t2 # 2.8 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 l1 l2 TOOLTEST h5diff_28.txt -v $FILE3 $FILE3 l1 l2 @@ -392,39 +383,30 @@ TOOLTEST h5diff_28.txt -v $FILE3 $FILE3 l1 l2 # ############################################################################## # 5.0 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset0a dset0b TOOLTEST h5diff_50.txt -v $FILE4 $FILE4 dset0a dset0b # 5.1 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset1a dset1b TOOLTEST h5diff_51.txt -v $FILE4 $FILE4 dset1a dset1b # 5.2 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset2a dset2b TOOLTEST h5diff_52.txt -v $FILE4 $FILE4 dset2a dset2b # 5.3 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset3a dset4b TOOLTEST h5diff_53.txt -v $FILE4 $FILE4 dset3a dset4b # 5.4 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset4a dset4b TOOLTEST h5diff_54.txt -v $FILE4 $FILE4 dset4a dset4b # 5.5 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset5a dset5b TOOLTEST h5diff_55.txt -v $FILE4 $FILE4 dset5a dset5b # 5.6 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset6a dset6b TOOLTEST h5diff_56.txt -v $FILE4 $FILE4 dset6a dset6b # 5.7 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset7a dset7b TOOLTEST h5diff_57.txt -v $FILE4 $FILE4 dset7a dset7b # 5.8 (region reference) -TESTING $H5DIFF -v $SRCFILE7 $SRCFILE8 refreg TOOLTEST h5diff_58.txt -v $FILE7 $FILE8 refreg # ############################################################################## @@ -433,7 +415,6 @@ TOOLTEST h5diff_58.txt -v $FILE7 $FILE8 refreg # 6.0: Check if the command line number of arguments is less than 3 -TESTING $H5DIFF $SRCFILE1 TOOLTEST h5diff_600.txt $FILE1 @@ -443,35 +424,27 @@ TOOLTEST h5diff_600.txt $FILE1 # 6.3: negative value -TESTING $H5DIFF -d -4 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_603.txt -d -4 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.4: zero -TESTING $H5DIFF -d 0 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_604.txt -d 0 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.5: non number -TESTING $H5DIFF -d u $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_605.txt -d u $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.6: hexadecimal -TESTING $H5DIFF -d 0x1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_606.txt -d 0x1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.7: string -TESTING $H5DIFF -d "1" $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_607.txt -d "1" $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.8: use system epsilon -TESTING $H5DIFF --use-system-epsilon $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_608.txt --use-system-epsilon $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.9: number larger than biggest difference -TESTING $H5DIFF -d 200 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_609.txt -d 200 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.10: number smaller than smallest difference -TESTING $H5DIFF -d 1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_610.txt -d 1 $FILE1 $FILE2 g1/dset3 g1/dset4 @@ -481,35 +454,27 @@ TOOLTEST h5diff_610.txt -d 1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.12: negative value -TESTING $H5DIFF -p -4 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_612.txt -p -4 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.13: zero -TESTING $H5DIFF -p 0 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_613.txt -p 0 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.14: non number -TESTING $H5DIFF -p u $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_614.txt -p u $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.15: hexadecimal -TESTING $H5DIFF -p 0x1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_615.txt -p 0x1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.16: string -TESTING $H5DIFF -p "0.21" $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_616.txt -p "0.21" $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.17: repeated option -TESTING $H5DIFF -p 0.21 -p 0.22 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_617.txt -p 0.21 -p 0.22 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.18: number larger than biggest difference -TESTING $H5DIFF -p 2 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_618.txt -p 2 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.19: number smaller than smallest difference -TESTING $H5DIFF -p 0.005 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_619.txt -p 0.005 $FILE1 $FILE2 g1/dset3 g1/dset4 @@ -519,110 +484,199 @@ TOOLTEST h5diff_619.txt -p 0.005 $FILE1 $FILE2 g1/dset3 g1/dset4 # ############################################################################## # 6.21: negative value -TESTING $H5DIFF -n -4 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_621.txt -n -4 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.22: zero -TESTING $H5DIFF -n 0 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_622.txt -n 0 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.23: non number -TESTING $H5DIFF -n u $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_623.txt -n u $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.24: hexadecimal -TESTING $H5DIFF -n 0x1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_624.txt -n 0x1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.25: string -TESTING $H5DIFF -n "2" $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_625.txt -n "2" $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.26: repeated option -TESTING $H5DIFF -n 2 -n 3 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_626.txt -n 2 -n 3 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.27: number larger than biggest difference -TESTING $H5DIFF --count=200 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_627.txt --count=200 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.28: number smaller than smallest difference -TESTING $H5DIFF -n 1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_628.txt -n 1 $FILE1 $FILE2 g1/dset3 g1/dset4 # Disabling this test as it hangs - LRK 20090618 # 6.29 non valid files -#TESTING $H5DIFF file1.h6 file2.h6 #TOOLTEST h5diff_629.txt file1.h6 file2.h6 # ############################################################################## # 7. attributes # ############################################################################## -TESTING $H5DIFF -v $SRCFILE5 $SRCFILE6 TOOLTEST h5diff_70.txt -v $FILE5 $FILE6 # ############################################################################## # 8. all dataset datatypes # ############################################################################## -TESTING $H5DIFF -v $SRCFILE7 $SRCFILE8 TOOLTEST h5diff_80.txt -v $FILE7 $FILE8 # 9. compare a file with itself -TESTING $H5DIFF -v $SRCFILE2 $SRCFILE2 TOOLTEST h5diff_90.txt -v $FILE2 $FILE2 # 10. read by hyperslab, print indexes if test -n "$pmode" -a "$mydomainname" = hdfgroup.uiuc.edu; then # skip this test which sometimes hangs in some THG machines - SKIP -v $SRCFILE9 $SRCFILE10 + SKIP -v $FILE9 $FILE10 else - TESTING $H5DIFF -v $SRCFILE9 $SRCFILE10 TOOLTEST h5diff_100.txt -v $FILE9 $FILE10 fi # 11. floating point comparison -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE1 g1/d1 g1/d2 TOOLTEST h5diff_101.txt -v $FILE1 $FILE1 g1/d1 g1/d2 -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE1 g1/fp1 g1/fp2 TOOLTEST h5diff_102.txt -v $FILE1 $FILE1 g1/fp1 g1/fp2 # not comparable -c flag -TESTING $H5DIFF $SRCFILE2 $SRCFILE2 g2/dset1 g2/dset2 TOOLTEST h5diff_200.txt $FILE2 $FILE2 g2/dset1 g2/dset2 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset1 g2/dset2 TOOLTEST h5diff_201.txt -c $FILE2 $FILE2 g2/dset1 g2/dset2 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset2 g2/dset3 TOOLTEST h5diff_202.txt -c $FILE2 $FILE2 g2/dset2 g2/dset3 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset3 g2/dset4 TOOLTEST h5diff_203.txt -c $FILE2 $FILE2 g2/dset3 g2/dset4 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset4 g2/dset5 TOOLTEST h5diff_204.txt -c $FILE2 $FILE2 g2/dset4 g2/dset5 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset5 g2/dset6 TOOLTEST h5diff_205.txt -c $FILE2 $FILE2 g2/dset5 g2/dset6 # not comparable in compound -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset7 g2/dset8 TOOLTEST h5diff_206.txt -c $FILE2 $FILE2 g2/dset7 g2/dset8 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset8 g2/dset9 TOOLTEST h5diff_207.txt -c $FILE2 $FILE2 g2/dset8 g2/dset9 - # ############################################################################## -# # Links +# # Links compare without --follow-links nor --no-dangling-links # ############################################################################## # test for bug1749 -TESTING $H5DIFF -v $SRCFILE12 $SRCFILE12 /link_g1 /link_g2 TOOLTEST h5diff_300.txt -v $FILE12 $FILE12 /link_g1 /link_g2 +# ############################################################################## +# # Links compare with --follow-links Only +# ############################################################################## +# soft links file to file +TOOLTEST h5diff_400.txt --follow-links -v $FILE13 $FILE13 + +# softlink vs dset" +TOOLTEST h5diff_401.txt --follow-links -v $FILE13 $FILE13 /softlink_dset1_1 /target_dset2 + +# dset vs softlink" +TOOLTEST h5diff_402.txt --follow-links -v $FILE13 $FILE13 /target_dset2 /softlink_dset1_1 + +# softlink vs softlink" +TOOLTEST h5diff_403.txt --follow-links -v $FILE13 $FILE13 /softlink_dset1_1 /softlink_dset2 + +# extlink vs extlink (FILE)" +TOOLTEST h5diff_404.txt --follow-links -v $FILE15 $FILE15 + +# extlink vs dset" +TOOLTEST h5diff_405.txt --follow-links -v $FILE15 $FILE16 /ext_link_dset1 /target_group2/x_dset + +# dset vs extlink" +TOOLTEST h5diff_406.txt --follow-links -v $FILE16 $FILE15 /target_group2/x_dset /ext_link_dset1 + +# extlink vs extlink" +TOOLTEST h5diff_407.txt --follow-links -v $FILE15 $FILE15 /ext_link_dset1 /ext_link_dset2 + +# softlink vs extlink" +TOOLTEST h5diff_408.txt --follow-links -v $FILE13 $FILE15 /softlink_dset1_1 /ext_link_dset2 + +# extlink vs softlink " +TOOLTEST h5diff_409.txt --follow-links -v $FILE15 $FILE13 /ext_link_dset2 /softlink_dset1_1 + +# linked_softlink vs linked_softlink (FILE)" +TOOLTEST h5diff_410.txt --follow-links -v $FILE14 $FILE14 + +# dset2 vs linked_softlink_dset1" +TOOLTEST h5diff_411.txt --follow-links -v $FILE14 $FILE14 /target_dset2 /softlink1_to_slink2 + +# linked_softlink_dset1 vs dset2" +TOOLTEST h5diff_412.txt --follow-links -v $FILE14 $FILE14 /softlink1_to_slink2 /target_dset2 + +# linked_softlink_to_dset1 vs linked_softlink_to_dset2" +TOOLTEST h5diff_413.txt --follow-links -v $FILE14 $FILE14 /softlink1_to_slink2 /softlink2_to_slink2 + +# group vs linked_softlink_group1" +TOOLTEST h5diff_414.txt --follow-links -v $FILE14 $FILE14 /target_group /softlink3_to_slink2 + +# linked_softlink_group1 vs group" +TOOLTEST h5diff_415.txt --follow-links -v $FILE14 $FILE14 /softlink3_to_slink2 /target_group + +# linked_softlink_to_group1 vs linked_softlink_to_group2" +TOOLTEST h5diff_416.txt --follow-links -v $FILE14 $FILE14 /softlink3_to_slink2 /softlink4_to_slink2 + +# non-exist-softlink vs softlink" +TOOLTEST h5diff_417.txt --follow-links -v $FILE13 $FILE13 /softlink_noexist /softlink_dset2 + +# softlink vs non-exist-softlink" +TOOLTEST h5diff_418.txt --follow-links -v $FILE13 $FILE13 /softlink_dset2 /softlink_noexist + +# non-exist-extlink_file vs extlink" +TOOLTEST h5diff_419.txt --follow-links -v $FILE15 $FILE15 /ext_link_noexist2 /ext_link_dset2 + +# exlink vs non-exist-extlink_file" +TOOLTEST h5diff_420.txt --follow-links -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist2 + +# extlink vs non-exist-extlink_obj" +TOOLTEST h5diff_421.txt --follow-links -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist1 + +# non-exist-extlink_obj vs extlink" +TOOLTEST h5diff_422.txt --follow-links -v $FILE15 $FILE15 /ext_link_noexist1 /ext_link_dset2 + +# extlink_to_softlink_to_dset1 vs dset2" +TOOLTEST h5diff_423.txt --follow-links -v $FILE17 $FILE18 /ext_link_to_slink1 /dset2 + +# dset2 vs extlink_to_softlink_to_dset1" +TOOLTEST h5diff_424.txt --follow-links -v $FILE18 $FILE17 /dset2 /ext_link_to_slink1 + +# extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2" +TOOLTEST h5diff_425.txt --follow-links -v $FILE17 $FILE17 /ext_link_to_slink1 /ext_link_to_slink2 + + +# ############################################################################## +# # Dangling links compare (--follow-links and --no-dangling-links) +# ############################################################################## +# dangling links --follow-links (FILE to FILE) +TOOLTEST h5diff_450.txt --follow-links -v $DANGLE_LINK_FILE1 $DANGLE_LINK_FILE2 + +# dangling links --follow-links and --no-dangling-links (FILE to FILE) +TOOLTEST h5diff_451.txt --follow-links -v --no-dangling-links $DANGLE_LINK_FILE1 $DANGLE_LINK_FILE2 + +# try --no-dangling-links without --follow-links options +TOOLTEST h5diff_452.txt --no-dangling-links $FILE13 $FILE13 + +# dangling link found for soft links (FILE to FILE) +TOOLTEST h5diff_453.txt --follow-links -v --no-dangling-links $FILE13 $FILE13 + +# dangling link found for soft links (obj to obj) +TOOLTEST h5diff_454.txt --follow-links -v --no-dangling-links $FILE13 $FILE13 /softlink_dset2 /softlink_noexist + +# dangling link found for soft links (obj to obj) Both dangle links +TOOLTEST h5diff_455.txt --follow-links -v --no-dangling-links $FILE13 $FILE13 /softlink_noexist /softlink_noexist + +# dangling link found for ext links (FILE to FILE) +TOOLTEST h5diff_456.txt --follow-links -v --no-dangling-links $FILE15 $FILE15 + +# dangling link found for ext links (obj to obj). target file exist +TOOLTEST h5diff_457.txt --follow-links -v --no-dangling-links $FILE15 $FILE15 /ext_link_dset1 /ext_link_noexist1 + +# dangling link found for ext links (obj to obj). target file NOT exist +TOOLTEST h5diff_458.txt --follow-links -v --no-dangling-links $FILE15 $FILE15 /ext_link_dset1 /ext_link_noexist2 + +# dangling link found for ext links (obj to obj). Both dangle links +TOOLTEST h5diff_459.txt --follow-links -v --no-dangling-links $FILE15 $FILE15 /ext_link_noexist1 /ext_link_noexist2 # ############################################################################## diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 998e96a..9e753fe 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -20,6 +20,28 @@ #include "h5tools.h" #include "h5tools_utils.h" +/* This code is layout for common code among tools */ +typedef enum toolname_t { + TOOL_H5DIFF, TOOL_H5LS, TOOL__H5DUMP /* add as necessary */ +} h5tool_toolname_t; +/* this struct can be used to differntiate among tools if necessary */ +typedef struct { + h5tool_toolname_t toolname; + int msg_mode; +} h5tool_opt_t; + +/* To return link info + * Functions: + * H5tools_get_link_info() + * Note: this may be move to h5tools code if used by other tools + */ +typedef struct { + H5O_type_t trg_type; /* OUT: target type */ + const char *trg_path; /* OUT: target obj path. This must be freed + * when used with H5tools_get_link_info() */ + H5L_info_t linfo; /* OUT: link info */ + h5tool_opt_t opt; /* IN: options */ +} h5tool_link_info_t; /* * Debug printf macros. The prefix allows output filtering by test scripts. */ @@ -65,6 +87,21 @@ do_print_objname (const char *OBJ, const char *path1, const char *path2) parallel_print("%-7s: <%s> and <%s>\n", OBJ, path1, path2); } +/*------------------------------------------------------------------------- + * Function: print_warn + * + * Purpose: check print warning condition. + * Return: + * 1 if verbose mode + * 0 if not verbos mode + * Programmer: Jonathan Kim + * Date: Feb 4, 2010 + *------------------------------------------------------------------------- + */ +static int print_warn(diff_opt_t *options) +{ + return ((options->m_verbose))?1:0; +} #ifdef H5_HAVE_PARALLEL @@ -83,9 +120,9 @@ do_print_objname (const char *OBJ, const char *path1, const char *path2) */ void phdiff_dismiss_workers(void) { - int i; - for(i=1; i0) && g_Parallel) - { - printf("%s", outBuff); - - if(overflow_file) - { - int tmp; - - rewind(overflow_file); - while((tmp = getc(overflow_file)) >= 0) - putchar(tmp); - - fclose(overflow_file); - overflow_file = NULL; - } - - fflush(stdout); - memset(outBuff, 0, OUTBUFF_SIZE); - outBuffOffset = 0; - } - else if( (outBuffOffset>0) && !g_Parallel) - { - fprintf(stderr, "h5diff error: outBuffOffset>0, but we're not in parallel!\n"); - } + /* If there was something we buffered, let's print it now */ + if( (outBuffOffset>0) && g_Parallel) + { + printf("%s", outBuff); + + if(overflow_file) + { + int tmp; + rewind(overflow_file); + while((tmp = getc(overflow_file)) >= 0) + putchar(tmp); + fclose(overflow_file); + overflow_file = NULL; + } + + fflush(stdout); + memset(outBuff, 0, OUTBUFF_SIZE); + outBuffOffset = 0; + } + else if( (outBuffOffset>0) && !g_Parallel) + { + fprintf(stderr, "h5diff error: outBuffOffset>0, but we're not in parallel!\n"); + } } /*------------------------------------------------------------------------- @@ -149,25 +184,201 @@ void print_manager_output(void) static void print_incoming_data(void) { - char data[PRINT_DATA_MAX_SIZE+1]; - int incomingMessage; - MPI_Status Status; - - do - { - MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status); - if(incomingMessage) - { - memset(data, 0, PRINT_DATA_MAX_SIZE+1); - MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); - - printf("%s", data); - } - } while(incomingMessage); + char data[PRINT_DATA_MAX_SIZE+1]; + int incomingMessage; + MPI_Status Status; + + do + { + MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status); + if(incomingMessage) + { + memset(data, 0, PRINT_DATA_MAX_SIZE+1); + MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); + + printf("%s", data); + } + } while(incomingMessage); } #endif /*------------------------------------------------------------------------- + * Function: is_valid_options + * + * Purpose: check if options are valid + * + * Return: + * 1 : Valid + * 0 : Not valid + * + * Programmer: Jonathan Kim + * + * Date: Feb 17, 2010 + * + *------------------------------------------------------------------------*/ +static int is_valid_options(diff_opt_t *options) +{ + int ret=1; /* init to valid */ + + /*----------------------------------------------- + * no -q(quiet) with -v (verbose) or -r (report) */ + if(options->m_quiet && (options->m_verbose || options->m_report)) + { + parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n"); + options->err_stat=1; + ret = 0; + goto out; + } + + /* ------------------------------------------------------- + * only allow --no-dangling-links along with --follow-links */ + if(options->no_dangle_links && !options->follow_links) + { + parallel_print("Error: --no-dangling-links must be used along with --follow-links option.\n"); + options->err_stat=1; + ret = 0; + goto out; + } + +out: + if (!ret) + { +#ifdef H5_HAVE_PARALLEL + if(g_Parallel) + /* Let tasks know that they won't be needed */ + phdiff_dismiss_workers(); +#endif + } + + return ret; +} + + +/*------------------------------------------------------------------------- + * Function: H5tools_get_link_info + * + * Purpose: Get link (soft, external) info and its target object type + (dataset, group, named datatype) and path, if exist + * + * Patameters: + * - [IN] fileid : link file id + * - [IN] linkpath : link path + * - [OUT] h5li : link's info (H5L_info_t) + * - [OUT] link_info: returning target object info (h5tool_link_info_t) + * + * Return: + * 1 : Succed to get link info. + * 0 : Detected as a dangling link + * -1 : H5 API failed. + * + * NOTE: + * link_info->trg_path must be freed out of this function + * + * Programmer: Jonathan Kim + * + * Date: Feb 8, 2010 + *-------------------------------------------------------------------------*/ +static int H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info) +{ + int Ret = -1; /* init to fail */ + htri_t l_ret; + H5O_info_t trg_oinfo; + hid_t fapl; + hid_t lapl = H5P_DEFAULT; + + /* init */ + link_info->trg_type = H5O_TYPE_UNKNOWN; + + /* check if link itself exist */ + if((H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0)) + { + if(link_info->opt.msg_mode==1) + parallel_print("Warning: link <%s> doesn't exist \n",linkpath); + goto out; + } + + /* get info from link */ + if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) + { + if(link_info->opt.msg_mode==1) + parallel_print("Warning: unable to get link info from <%s>\n",linkpath); + goto out; + } + + /* trg_path must be freed out of this function when finished using */ + link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char)); + HDassert(link_info->trg_path); + + /* get link value */ + if(H5Lget_val(file_id, linkpath, link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) + { + if(link_info->opt.msg_mode==1) + parallel_print("Warning: unable to get link value from <%s>\n",linkpath); + goto out; + } + + /*----------------------------------------------------- + * if link type is external link use different lapl to + * follow object in other file + */ + if (link_info->linfo.type == H5L_TYPE_EXTERNAL) + { + fapl = H5Pcreate(H5P_FILE_ACCESS); + H5Pset_fapl_sec2(fapl); + lapl = H5Pcreate(H5P_LINK_ACCESS); + H5Pset_elink_fapl(lapl, fapl); + } + + /*-------------------------------------------------------------- + * if link's target object exist, get type + */ + /* check if target object exist */ + l_ret = H5Oexists_by_name(file_id, linkpath, lapl); + + /* detect dangling link */ + if(l_ret == FALSE) + { + Ret = 0; + goto out; + } + /* function failed */ + else if (l_ret < 0) + { + goto out; + } + + /* get target object info */ + if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0) + { + if(link_info->opt.msg_mode==1) + parallel_print("Warning: unable to get object information for <%s>\n", linkpath); + goto out; + } + + /* check unknown type */ + if (trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES) + { + if(link_info->opt.msg_mode==1) + parallel_print("Warning: target object of <%s> is unknown type\n", linkpath); + goto out; + } + + /* set target obj type to return */ + link_info->trg_type = trg_oinfo.type; + + /* succeed */ + Ret = 1; +out: + if (link_info->linfo.type == H5L_TYPE_EXTERNAL) + { + H5Pclose(fapl); + H5Pclose(lapl); + } + + return Ret; +} + +/*------------------------------------------------------------------------- * Function: h5diff * * Purpose: public function, can be called in an application program. @@ -181,7 +392,6 @@ static void print_incoming_data(void) * *------------------------------------------------------------------------- */ - hsize_t h5diff(const char *fname1, const char *fname2, const char *objname1, @@ -197,12 +407,11 @@ hsize_t h5diff(const char *fname1, HDmemset(filenames, 0, 1024 * 2); - if(options->m_quiet && (options->m_verbose || options->m_report)) - { - parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n"); - options->err_stat=1; - return 0; - } /* end if */ + /*------------------------------------------------------------------------- + * check invalid combination of options + *-----------------------------------------------------------------------*/ + if(!is_valid_options(options)) + goto out; /*------------------------------------------------------------------------- * open the files first; if they are not valid, no point in continuing @@ -214,7 +423,7 @@ hsize_t h5diff(const char *fname1, { /* open file 1 */ - if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) + if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname1); @@ -230,8 +439,8 @@ hsize_t h5diff(const char *fname1, /* open file 2 */ - - if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) + + if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname2); @@ -292,12 +501,10 @@ hsize_t h5diff(const char *fname1, info2, options); } /* end if */ - /*------------------------------------------------------------------------- * compare all *------------------------------------------------------------------------- */ - else { #ifdef H5_HAVE_PARALLEL @@ -461,14 +668,14 @@ hsize_t diff_match(hid_t file1_id, * 2) the graph must match, i.e same names (absolute path) * 3) objects with the same name must be of the same type *------------------------------------------------------------------------- - */ - + */ + /* number of different objects */ if ( info1->nused != info2->nused ) { options->contents = 0; } - + /* objects in one file and not the other */ for( i = 0; i < table->nobjs; i++) { @@ -479,7 +686,7 @@ hsize_t diff_match(hid_t file1_id, } /* objects with the same name but different HDF5 types */ - for( i = 0; i < table->nobjs; i++) + for( i = 0; i < table->nobjs; i++) { if ( table->objs[i].flags[0] && table->objs[i].flags[1] ) { @@ -497,8 +704,8 @@ hsize_t diff_match(hid_t file1_id, *------------------------------------------------------------------------- */ #ifdef H5_HAVE_PARALLEL -{ - char *workerTasks = HDmalloc((g_nTasks - 1) * sizeof(char)); + { + char *workerTasks = (char*)HDmalloc((g_nTasks - 1) * sizeof(char)); int n; int busyTasks = 0; struct diffs_found nFoundbyWorker; @@ -789,7 +996,7 @@ hsize_t diff_match(hid_t file1_id, h5diffdebug("done with if block\n"); free(workerTasks); -} + } #endif /* H5_HAVE_PARALLEL */ /* free table */ @@ -807,9 +1014,10 @@ hsize_t diff_match(hid_t file1_id, * Return: Number of differences found * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * * Date: May 9, 2003 * + * Programmer: Jonathan Kim + * - add following links feature (Feb 11,2010) *------------------------------------------------------------------------- */ @@ -826,9 +1034,24 @@ hsize_t diff_compare(hid_t file1_id, int f1 = 0; int f2 = 0; hsize_t nfound = 0; + ssize_t i,j; + int l_ret; + int is_dangle_link1 = 0; + int is_dangle_link2 = 0; + + /* local variables for diff() */ + h5trav_type_t obj1type, obj2type; - ssize_t i = h5trav_getindex (info1, obj1_name); - ssize_t j = h5trav_getindex (info2, obj2_name); + /* to get link info */ + h5tool_link_info_t linkinfo1; + h5tool_link_info_t linkinfo2; + + /* init link info struct */ + HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t)); + HDmemset(&linkinfo2, 0, sizeof(h5tool_link_info_t)); + + i = h5trav_getindex (info1, obj1_name); + j = h5trav_getindex (info2, obj2_name); if (i == -1) { @@ -852,25 +1075,217 @@ hsize_t diff_compare(hid_t file1_id, obj1_name = info1->paths[i].path; obj2_name = info2->paths[j].path; + obj1type = info1->paths[i].type; + obj2type = info2->paths[j].type; + + /*----------------------------------------------------------------- + * follow link option, compare with target object + */ + if (options->follow_links) + { + /* pass how to handle printing warning to linkinfo option */ + if(print_warn(options)) + linkinfo1.opt.msg_mode = linkinfo2.opt.msg_mode = 1; + + /*------------------------------------------------------------ + * Soft links + *------------------------------------------------------------*/ + + /*-------------------------- + * if object1 soft link */ + if (obj1type == H5TRAV_TYPE_LINK) + { + /* get type of target object */ + l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1); + /* dangling link */ + if (l_ret == 0) + { + if (options->no_dangle_links) + { + /* gangling link is error */ + if(options->m_verbose) + parallel_print("Warning: <%s> is a dangling link.\n", obj1_name); + options->err_stat = 1; + goto out; + } + else + is_dangle_link1 = 1; + } + /* fail */ + else if(l_ret < 0) + { + options->err_stat = 1; + goto out; + } + else /* OK */ + { + /* target type for diff() */ + obj1type = linkinfo1.trg_type; + } + } + + /*----------------------------- + * if object2 is soft link */ + if (obj2type == H5TRAV_TYPE_LINK) + { + /* get type target object */ + l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2); + /* dangling link */ + if (l_ret == 0) + { + if (options->no_dangle_links) + { + /* gangling link is error */ + if(options->m_verbose) + parallel_print("Warning: <%s> is a dangling link.\n", obj2_name); + options->err_stat = 1; + goto out; + } + else + is_dangle_link2=1; + } + /* fail */ + else if(l_ret < 0) + { + options->err_stat = 1; + goto out; + } + else /* OK */ + { + /* target type for diff() */ + obj2type = linkinfo2.trg_type; + } + } + + /*------------------------------------------------------------ + * External links + *------------------------------------------------------------*/ + + /*-------------------------------- + * if object1 is external link */ + if (obj1type == H5TRAV_TYPE_UDLINK) + { + /* get type and name of target object */ + l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1); + /* dangling link */ + if (l_ret == 0) + { + if (options->no_dangle_links) + { + /* gangling link is error */ + if(options->m_verbose) + parallel_print("Warning: <%s> is a dangling link.\n", obj1_name); + options->err_stat = 1; + goto out; + } + else + is_dangle_link1 = 1; + } + /* fail */ + else if(l_ret < 0) + { + options->err_stat = 1; + goto out; + } + else /* OK */ + { + /* for external link */ + if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL) + obj1type = linkinfo1.trg_type; + } + } + + /*-------------------------------- + * if object2 is external link */ + if (obj2type == H5TRAV_TYPE_UDLINK) + { + /* get type and name of target object */ + l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2); + /* dangling link */ + if (l_ret == 0) + { + if (options->no_dangle_links) + { + /* gangling link is error */ + if(options->m_verbose) + parallel_print("Warning: <%s> is a dangling link.\n", obj2_name); + options->err_stat = 1; + goto out; + } + else + is_dangle_link2 = 1; + } + /* fail */ + else if(l_ret < 0) + { + options->err_stat = 1; + goto out; + } + else /* OK */ + { + /* for external link */ + if(linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) + obj2type = linkinfo2.trg_type; + } + } + /* found dangling link */ + if (is_dangle_link1 || is_dangle_link2) + goto out; + } /* end of follow_links */ + /* objects are not the same type */ - if (info1->paths[i].type != info2->paths[j].type) + if (obj1type != obj2type) { if (options->m_verbose||options->m_list_not_cmp) { parallel_print("<%s> is of type %s and <%s> is of type %s\n", - obj1_name, get_type(info1->paths[i].type), obj2_name, - get_type(info2->paths[j].type)); + obj1_name, get_type(obj1type), + obj2_name, get_type(obj2type)); } options->not_cmp=1; - return 0; + goto out; + } + + nfound = diff(file1_id, obj1_name, + file2_id, obj2_name, + options, obj1type); + +out: + /*------------------------------- + * handle dangling link(s) */ + /* both obj1 and obj2 are dangling links */ + if(is_dangle_link1 && is_dangle_link2) + { + if(print_objname(options, nfound)) + { + do_print_objname("dangling link", obj1_name, obj2_name); + print_found(nfound); + } + } + /* obj1 is dangling link */ + else if (is_dangle_link1) + { + if(options->m_verbose) + parallel_print("obj1 <%s> is a dangling link.\n", obj1_name); + nfound++; + if(print_objname(options, nfound)) + print_found(nfound); + } + /* obj2 is dangling link */ + else if (is_dangle_link2) + { + if(options->m_verbose) + parallel_print("obj2 <%s> is a dangling link.\n", obj2_name); + nfound++; + if(print_objname(options, nfound)) + print_found(nfound); } - nfound = diff(file1_id, - obj1_name, - file2_id, - obj2_name, - options, - info1->paths[i].type); + /* free link info buffer */ + if (linkinfo1.trg_path) + HDfree(linkinfo1.trg_path); + if (linkinfo2.trg_path) + HDfree(linkinfo2.trg_path); return nfound; } @@ -889,9 +1304,10 @@ hsize_t diff_compare(hid_t file1_id, * Return: Number of differences found * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * * Date: May 9, 2003 * + * Programmer: Jonathan Kim + * - add following links feature (Feb 11,2010) *------------------------------------------------------------------------- */ @@ -907,13 +1323,28 @@ hsize_t diff(hid_t file1_id, hid_t grp1_id = (-1); hid_t grp2_id = (-1); int ret; + int is_dangle_link1 = 0; + int is_dangle_link2 = 0; hsize_t nfound = 0; + + /* to get link info */ + h5tool_link_info_t linkinfo1; + h5tool_link_info_t linkinfo2; + + /*init link info struct */ + HDmemset(&linkinfo1,0,sizeof(h5tool_link_info_t)); + HDmemset(&linkinfo2,0,sizeof(h5tool_link_info_t)); + + /* pass how to handle printing warnings to linkinfo option */ + if(print_warn(options)) + linkinfo1.opt.msg_mode = linkinfo2.opt.msg_mode = 1; + switch(type) { - /*------------------------------------------------------------------------- + /*---------------------------------------------------------------------- * H5TRAV_TYPE_DATASET - *------------------------------------------------------------------------- + *---------------------------------------------------------------------- */ case H5TRAV_TYPE_DATASET: /* verbose (-v) and report (-r) mode */ @@ -932,18 +1363,18 @@ hsize_t diff(hid_t file1_id, else { nfound = diff_dataset(file1_id, file2_id, path1, path2, options); - /* not comparable, no display the different number */ + /* print info if compatible and difference found */ if (!options->not_cmp && nfound) { do_print_objname("dataset", path1, path2); - print_found(nfound); + print_found(nfound); } } break; - /*------------------------------------------------------------------------- + /*---------------------------------------------------------------------- * H5TRAV_TYPE_NAMED_DATATYPE - *------------------------------------------------------------------------- + *---------------------------------------------------------------------- */ case H5TRAV_TYPE_NAMED_DATATYPE: if((type1_id = H5Topen2(file1_id, path1, H5P_DEFAULT)) < 0) @@ -964,10 +1395,11 @@ hsize_t diff(hid_t file1_id, if(options->m_verbose) print_found(nfound); - /*------------------------------------------------------------------------- + /*----------------------------------------------------------------- * compare attributes - * the if condition refers to cases when the dataset is a referenced object - *------------------------------------------------------------------------- + * the if condition refers to cases when the dataset is a + * referenced object + *----------------------------------------------------------------- */ if(path1) nfound += diff_attr(type1_id, type2_id, path1, path2, options); @@ -978,9 +1410,9 @@ hsize_t diff(hid_t file1_id, goto out; break; - /*------------------------------------------------------------------------- + /*---------------------------------------------------------------------- * H5TRAV_TYPE_GROUP - *------------------------------------------------------------------------- + *---------------------------------------------------------------------- */ case H5TRAV_TYPE_GROUP: ret = HDstrcmp(path1, path2); @@ -1000,10 +1432,11 @@ hsize_t diff(hid_t file1_id, if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0) goto out; - /*------------------------------------------------------------------------- + /*----------------------------------------------------------------- * compare attributes - * the if condition refers to cases when the dataset is a referenced object - *------------------------------------------------------------------------- + * the if condition refers to cases when the dataset is a + * referenced object + *----------------------------------------------------------------- */ if(path1) nfound += diff_attr(grp1_id, grp2_id, path1, path2, options); @@ -1015,93 +1448,180 @@ hsize_t diff(hid_t file1_id, break; - /*------------------------------------------------------------------------- + /*---------------------------------------------------------------------- * H5TRAV_TYPE_LINK - *------------------------------------------------------------------------- + *---------------------------------------------------------------------- */ case H5TRAV_TYPE_LINK: { - H5L_info_t li1, li2; - char *buf1, *buf2; - - if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0) - goto out; - if(H5Lget_info(file2_id, path2, &li2, H5P_DEFAULT) < 0) + /* get type and name of target object */ + ret = H5tools_get_link_info(file1_id, path1, &linkinfo1); + /* dangling link */ + if (ret == 0) + { + if (options->no_dangle_links) + { + /* gangling link is error */ + if(options->m_verbose) + parallel_print("Warning: <%s> is a dangling link.\n", path1); + goto out; + } + else + is_dangle_link1 = 1; + } + else if (ret < 0) goto out; - buf1 = HDmalloc(li1.u.val_size); - buf2 = HDmalloc(li2.u.val_size); - - if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) - goto out; - if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0) + /* get type and name of target object */ + ret = H5tools_get_link_info(file2_id, path2, &linkinfo2); + /* dangling link */ + if (ret == 0) + { + if (options->no_dangle_links) + { + /* gangling link is error */ + if(options->m_verbose) + parallel_print("Warning: <%s> is a dangling link.\n", path2); + goto out; + } + else + is_dangle_link2 = 1; + } + else if (ret < 0) goto out; + + + /* found dangling link */ + if (is_dangle_link1 || is_dangle_link2) + goto out2; - ret = HDstrcmp(buf1, buf2); + ret = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path); - /* if "buf1" != "buf2" then the links are "different" */ + /* if the target link name is not same then the links are "different" */ nfound = (ret != 0) ? 1 : 0; if(print_objname(options, nfound)) do_print_objname("link", path1, path2); + if (options->follow_links) + { + /* objects are not the same type */ + if (linkinfo1.trg_type != linkinfo2.trg_type) + { + if (options->m_verbose||options->m_list_not_cmp) + { + parallel_print("<%s> is of type %s and <%s> is of type %s\n", path1, get_type(linkinfo1.trg_type), path2, get_type(linkinfo2.trg_type)); + } + options->not_cmp=1; + goto out; + } + + /* call self to compare target object */ + nfound += diff(file1_id, path1, + file2_id, path2, + options, linkinfo1.trg_type); + } + /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); - HDfree(buf1); - HDfree(buf2); + /* free link info buffer */ + HDfree(linkinfo1.trg_path); + HDfree(linkinfo2.trg_path); } break; - /*------------------------------------------------------------------------- + /*---------------------------------------------------------------------- * H5TRAV_TYPE_UDLINK - *------------------------------------------------------------------------- + *---------------------------------------------------------------------- */ case H5TRAV_TYPE_UDLINK: { - H5L_info_t li1, li2; - - if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0) - goto out; - if(H5Lget_info(file2_id, path2, &li2, H5P_DEFAULT) < 0) + /* get type and name of target object */ + ret = H5tools_get_link_info(file1_id, path1, &linkinfo1); + /* dangling link */ + if (ret == 0) + { + if (options->no_dangle_links) + { + /* gangling link is error */ + if(options->m_verbose) + parallel_print("Warning: <%s> is a dangling link.\n", path1); + goto out; + } + else + is_dangle_link1=1; + } + else if (ret < 0) goto out; - /* Only external links will have a query function registered */ - if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL) { - char *buf1, *buf2; - - buf1 = HDmalloc(li1.u.val_size); - buf2 = HDmalloc(li2.u.val_size); - - if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) { - HDfree(buf1); - HDfree(buf2); - goto out; - } /* end if */ - if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0) { - HDfree(buf1); - HDfree(buf2); + /* get type and name of target object */ + ret = H5tools_get_link_info(file2_id, path2, &linkinfo2); + /* dangling link */ + if (ret == 0) + { + if (options->no_dangle_links) + { + /* gangling link is error */ + if(options->m_verbose) + parallel_print("Warning: <%s> is a dangling link.\n", path2); goto out; - } /* end if */ + } + else + is_dangle_link2=1; + } + else if (ret < 0) + goto out; + + /* found dangling link */ + if (is_dangle_link1 || is_dangle_link2) + goto out2; + /* Only external links will have a query function registered */ + if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) + { /* If the buffers are the same size, compare them */ - if(li1.u.val_size == li2.u.val_size) { - ret = HDmemcmp(buf1, buf2, li1.u.val_size); + if(linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size) + { + ret = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size); } else ret = 1; - /* if "buf1" != "buf2" then the links are "different" */ + /* if "linkinfo1.trg_path" != "linkinfo2.trg_path" then the links + * are "different" extlinkinfo#.path is combination string of + * file_name and obj_name + */ nfound = (ret != 0) ? 1 : 0; if(print_objname(options, nfound)) do_print_objname("external link", path1, path2); - HDfree(buf1); - HDfree(buf2); + if (options->follow_links) + { + /* objects are not the same type */ + if (linkinfo1.trg_type != linkinfo2.trg_type) + { + if (options->m_verbose||options->m_list_not_cmp) + { + parallel_print("<%s> is of type %s and <%s> is of type %s\n", path1, get_type(linkinfo1.trg_type), path2, get_type(linkinfo2.trg_type)); + } + options->not_cmp=1; + goto out; + } + + nfound = diff(file1_id, path1, + file2_id, path2, + options, linkinfo1.trg_type); + } + + /* free link info buffer */ + HDfree(linkinfo1.trg_path); + HDfree(linkinfo2.trg_path); } /* end if */ - else { + else + { /* If one or both of these links isn't an external link, we can only * compare information from H5Lget_info since we don't have a query * function registered for them. @@ -1109,7 +1629,8 @@ hsize_t diff(hid_t file1_id, * If the link classes or the buffer length are not the * same, the links are "different" */ - if((li1.type != li2.type) || (li1.u.val_size != li2.u.val_size)) + if((linkinfo1.linfo.type != linkinfo2.linfo.type) || + (linkinfo1.linfo.u.val_size != linkinfo2.linfo.u.val_size)) nfound = 1; else nfound = 0; @@ -1137,6 +1658,44 @@ hsize_t diff(hid_t file1_id, out: options->err_stat = 1; +out2: + /*----------------------------------- + * handle dangling link(s) + */ + /* both path1 and path2 are dangling links */ + if(is_dangle_link1 && is_dangle_link2) + { + if(print_objname(options, nfound)) + { + do_print_objname("dangling link", path1, path2); + print_found(nfound); + } + } + /* path1 is dangling link */ + else if (is_dangle_link1) + { + if(options->m_verbose) + parallel_print("obj1 <%s> is a dangling link.\n", path1); + nfound++; + if(print_objname(options, nfound)) + print_found(nfound); + } + /* path2 is dangling link */ + else if (is_dangle_link2) + { + if(options->m_verbose) + parallel_print("obj2 <%s> is a dangling link.\n", path2); + nfound++; + if(print_objname(options, nfound)) + print_found(nfound); + } + + /* free link info buffer */ + if (linkinfo1.trg_path) + HDfree(linkinfo1.trg_path); + if (linkinfo2.trg_path) + HDfree(linkinfo2.trg_path); + /* close */ /* disable error reporting */ H5E_BEGIN_TRY { diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index df264dd..6718d9a 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -35,6 +35,8 @@ typedef struct { double percent; /* relative error value */ int n; /* count, compare up to count */ hsize_t count; /* count value */ + int follow_links; /* follow symbolic links */ + int no_dangle_links; /* return error when find dangling link */ int err_stat; /* an error ocurred (1, error, 0, no error) */ int cmn_objs; /* do we have common objects */ int not_cmp; /* are the objects comparable */ -- cgit v0.12