summaryrefslogtreecommitdiffstats
path: root/tools/h5jam
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-03-21 15:10:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-03-21 15:10:17 (GMT)
commiteb89d7b53ab95623ab454186a602e1cafc7391f0 (patch)
treeceafe458b3011e38853e765352d3c7e59bbecce1 /tools/h5jam
parent3e468e6ff65d540a439e99ea568a6bff7add7cea (diff)
downloadhdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.zip
hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.gz
hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.bz2
[svn-r22105] Description:
Bring r20557:22085 from trunk to this branch, also fixing some other issues/failures in the branch simultaneously. The h5repack tests are still failing, but Neil will be checking into those, so the branch can be fully functional again. Tested on: Mac OSX/64 10.7.3 (amazon) w/debug
Diffstat (limited to 'tools/h5jam')
-rw-r--r--tools/h5jam/CMakeLists.txt90
-rw-r--r--tools/h5jam/Makefile.in3
-rw-r--r--tools/h5jam/getub.c28
-rw-r--r--tools/h5jam/h5jam.c499
-rw-r--r--tools/h5jam/h5jamgentest.c24
-rw-r--r--tools/h5jam/h5unjam.c251
-rw-r--r--tools/h5jam/tellub.c26
-rw-r--r--tools/h5jam/testfiles/h5jam-help.txt24
-rw-r--r--tools/h5jam/testfiles/h5jam-ub-nohdf5.txt2
-rw-r--r--tools/h5jam/testfiles/h5unjam-help.txt27
-rw-r--r--tools/h5jam/testh5jam.sh.in315
11 files changed, 862 insertions, 427 deletions
diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt
index 81a624d..a03d139 100644
--- a/tools/h5jam/CMakeLists.txt
+++ b/tools/h5jam/CMakeLists.txt
@@ -1,11 +1,10 @@
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 2.8.6)
PROJECT (HDF5_TOOLS_H5JAM)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
-INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
# Add the h5jam executables
@@ -13,18 +12,22 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
ADD_EXECUTABLE (h5jam ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jam.c)
TARGET_NAMING (h5jam ${LIB_TYPE})
TARGET_LINK_LIBRARIES (h5jam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+SET_TARGET_PROPERTIES (h5jam PROPERTIES FOLDER tools)
ADD_EXECUTABLE (getub ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/getub.c)
TARGET_NAMING (getub ${LIB_TYPE})
TARGET_LINK_LIBRARIES (getub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+SET_TARGET_PROPERTIES (getub PROPERTIES FOLDER tools)
ADD_EXECUTABLE (tellub ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/tellub.c)
TARGET_NAMING (tellub ${LIB_TYPE})
TARGET_LINK_LIBRARIES (tellub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+SET_TARGET_PROPERTIES (tellub PROPERTIES FOLDER tools)
ADD_EXECUTABLE (h5unjam ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5unjam.c)
TARGET_NAMING (h5unjam ${LIB_TYPE})
TARGET_LINK_LIBRARIES (h5unjam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+SET_TARGET_PROPERTIES (h5unjam PROPERTIES FOLDER tools)
SET (H5_DEP_EXECUTABLES
h5jam
@@ -46,7 +49,8 @@ IF (BUILD_TESTING)
IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5jamgentest ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jamgentest.c)
TARGET_NAMING (h5jamgentest ${LIB_TYPE})
- TARGET_LINK_LIBRARIES (h5jamgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ TARGET_LINK_LIBRARIES (h5jamgentest ${HDF5_LIB_TARGET})
+ SET_TARGET_PROPERTIES (h5jamgentest PROPERTIES FOLDER generator/tools)
#ADD_TEST (NAME h5jamgentest COMMAND $<TARGET_FILE:h5jamgentest>)
ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
@@ -56,6 +60,9 @@ IF (BUILD_TESTING)
u511.txt
u512.txt
u513.txt
+ h5jam-help.txt
+ h5unjam-help.txt
+ h5jam-ub-nohdf5.txt
)
SET (HDF5_REFERENCE_TEST_FILES
tall.h5
@@ -92,6 +99,58 @@ IF (BUILD_TESTING)
##############################################################################
##############################################################################
+ # ============================================================
+ # TEST_H5JAM_OUTPUT
+ # For the purpose to verify only output & exitcode from h5jam
+ #
+ MACRO (TEST_H5JAM_OUTPUT expectfile resultcode)
+ # If using memchecker add tests without using scripts
+ IF (HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (NAME H5JAM-${expectfile} COMMAND $<TARGET_FILE:h5jam> ${ARGN})
+ IF (NOT "${resultcode}" STREQUAL "0")
+ SET_TESTS_PROPERTIES (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true")
+ ENDIF (NOT "${resultcode}" STREQUAL "0")
+ ELSE (HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5JAM-${expectfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5jam>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${expectfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=testfiles/${expectfile}.txt"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (TEST_H5JAM_OUTPUT)
+
+ # ============================================================
+ # TEST_H5UNJAM_OUTPUT
+ # For the purpose to verify only output & exitcode from h5unjam
+ #
+ MACRO (TEST_H5UNJAM_OUTPUT expectfile resultcode)
+ # If using memchecker add tests without using scripts
+ IF (HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (NAME H5JAM-UNJAM-${expectfile} COMMAND $<TARGET_FILE:h5unjam> ${ARGN})
+ IF (NOT "${resultcode}" STREQUAL "0")
+ SET_TESTS_PROPERTIES (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true")
+ ENDIF (NOT "${resultcode}" STREQUAL "0")
+ ELSE (HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5JAM-UNJAM-${expectfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${expectfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=testfiles/${expectfile}.txt"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (TEST_H5UNJAM_OUTPUT)
+
MACRO (CLEANUP testname)
ADD_TEST (
NAME H5JAM-CLEANUP-${testname}-clear-objects
@@ -119,7 +178,7 @@ IF (BUILD_TESTING)
SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
ADD_TEST (
- NAME H5JAM-CHECKFILE-H5DUMP-${testname}
+ NAME H5JAM-CHECKFILE-H5DMP-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
-D "TEST_ARGS:STRING=testfiles/${expected}"
@@ -130,9 +189,9 @@ IF (BUILD_TESTING)
-D "TEST_SKIP_COMPARE=TRUE"
-P "${HDF5_RESOURCES_DIR}/runTest.cmake"
)
- SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-H5DUMP-${testname} PROPERTIES DEPENDS H5JAM-CHECKFILE-${testname}-clear-objects)
+ SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-H5DMP-${testname} PROPERTIES DEPENDS H5JAM-CHECKFILE-${testname}-clear-objects)
ADD_TEST (
- NAME H5JAM-CHECKFILE-H5DUMP_CMP-${testname}
+ NAME H5JAM-CHECKFILE-H5DMP_CMP-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
-D "TEST_ARGS:STRING=${actual}"
@@ -143,8 +202,8 @@ IF (BUILD_TESTING)
-D "TEST_REFERENCE=${expected}.new"
-P "${HDF5_RESOURCES_DIR}/runTest.cmake"
)
- SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-H5DUMP_CMP-${testname} PROPERTIES DEPENDS H5JAM-CHECKFILE-H5DUMP-${testname})
- SET (last_test "H5JAM-CHECKFILE-H5DUMP_CMP-${testname}")
+ SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-H5DMP_CMP-${testname} PROPERTIES DEPENDS H5JAM-CHECKFILE-H5DMP-${testname})
+ SET (last_test "H5JAM-CHECKFILE-H5DMP_CMP-${testname}")
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ENDMACRO(CHECKFILE testname expected actual)
@@ -309,6 +368,15 @@ IF (BUILD_TESTING)
##############################################################################
##############################################################################
+#-------------------------------
+# Testing h5jam
+#-------------------------------
+ # help page
+ TEST_H5JAM_OUTPUT(h5jam-help 0 -h)
+
+ # don't allow HDF5 format file as an user block file
+ TEST_H5JAM_OUTPUT(h5jam-ub-nohdf5 1 -i testfiles/tall.h5 -u testfiles/tall.h5 -o tall-tmp.h5)
+
JAMTEST (tall_u10 u10.txt tall.h5 ta2.h5)
CHECKFILE (tall_u10 tall.h5 ta2.h5)
# CLEANUP (tall_u10 ta2.h5)
@@ -422,6 +490,12 @@ IF (BUILD_TESTING)
CHECKFILE (N_twithub513_u513_c tall.h5 tay9.h5)
# CLEANUP (N_twithub513_u513_c tay9.h5)
+#-------------------------------
+# Testing h5unjam
+#-------------------------------
+ # help page
+ TEST_H5UNJAM_OUTPUT(h5unjam-help 0 -h)
+
SETUP (twithub_tall twithub.h5 tai1.h5)
UNJAMTEST (twithub_tall tai1.h5 o10.txt taa1.h5)
CHECKFILE (twithub_tall tall.h5 taa1.h5)
diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in
index 78e446d..31190ec 100644
--- a/tools/h5jam/Makefile.in
+++ b/tools/h5jam/Makefile.in
@@ -195,6 +195,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
+FC2003 = @FC2003@
FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
@@ -215,10 +216,12 @@ H5_LONE_COLON = @H5_LONE_COLON@
H5_VERSION = @H5_VERSION@
HADDR_T = @HADDR_T@
HAVE_DMALLOC = @HAVE_DMALLOC@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
HDF5_HL = @HDF5_HL@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF_CXX = @HDF_CXX@
HDF_FORTRAN = @HDF_FORTRAN@
+HDF_FORTRAN2003 = @HDF_FORTRAN2003@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c
index 293aa17..f536605 100644
--- a/tools/h5jam/getub.c
+++ b/tools/h5jam/getub.c
@@ -21,6 +21,7 @@
#endif
#include "H5private.h"
+#include "h5tools.h"
#include "h5tools_utils.h"
void parse_command_line (int argc, const char *argv[]);
@@ -32,9 +33,9 @@ void parse_command_line (int argc, const char *argv[]);
#define PROGRAMNAME "getub"
char *nbytes = NULL;
-static const char *s_opts = "c:"; /* add more later ? */
+static const char *s_opts = "c:"; /* add more later ? */
static struct long_options l_opts[] = {
- {"c", require_arg, 'c'}, /* input file */
+ {"c", require_arg, 'c'}, /* input file */
{NULL, 0, '\0'}
};
@@ -84,15 +85,15 @@ parse_command_line (int argc, const char *argv[])
while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char) opt)
- {
- case 'c':
- nbytes = HDstrdup (opt_arg);
- break;
- case '?':
- default:
- usage (h5tools_getprogname());
- exit (EXIT_FAILURE);
- }
+ {
+ case 'c':
+ nbytes = HDstrdup (opt_arg);
+ break;
+ case '?':
+ default:
+ usage (h5tools_getprogname());
+ exit (EXIT_FAILURE);
+ }
}
if (argc <= opt_ind)
@@ -115,6 +116,9 @@ main (int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
+ /* Initialize h5tools lib */
+ h5tools_init();
+
parse_command_line (argc, argv);
if (nbytes == NULL)
@@ -161,7 +165,7 @@ main (int argc, const char *argv[])
if (res < (long)size)
{
if (buf)
- free (buf);
+ free (buf);
HDclose (fd);
exit (EXIT_FAILURE);
}
diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c
index 5eaa26a..981eead 100644
--- a/tools/h5jam/h5jam.c
+++ b/tools/h5jam/h5jam.c
@@ -15,6 +15,7 @@
#include "hdf5.h"
#include "H5private.h"
+#include "h5tools.h"
#include "h5tools_utils.h"
/* Name of tool */
@@ -38,14 +39,14 @@ char *ub_file = NULL;
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
-static const char *s_opts = "hi:u:o:c:V"; /* add more later ? */
+static const char *s_opts = "hi:u:o:c:V"; /* add more later ? */
static struct long_options l_opts[] = {
{"help", no_arg, 'h'},
{"hel", no_arg, 'h'},
- {"i", require_arg, 'i'}, /* input file */
- {"u", require_arg, 'u'}, /* user block file */
- {"o", require_arg, 'o'}, /* output file */
- {"clobber", no_arg, 'c'}, /* clobber existing UB */
+ {"i", require_arg, 'i'}, /* input file */
+ {"u", require_arg, 'u'}, /* user block file */
+ {"o", require_arg, 'o'}, /* output file */
+ {"clobber", no_arg, 'c'}, /* clobber existing UB */
{"clobbe", no_arg, 'c'},
{"clobb", no_arg, 'c'},
{"clob", no_arg, 'c'},
@@ -70,20 +71,76 @@ static struct long_options l_opts[] = {
static void
usage (const char *prog)
{
- fflush (stdout);
- fprintf (stdout,
- "usage: %s -u user_block_file -i h5_file [-o ofile | --clobber] \n",
- prog);
- fprintf (stdout, " Add 'user_block_file' to front of \n");
- fprintf (stdout,
- " 'h5_file', pad so 'h5_file' starts on proper\n");
- fprintf (stdout, " byte.\n");
- fprintf (stdout, "\n");
- fprintf (stdout, " %s -h \n", prog);
- fprintf (stdout, " Print a usage message and exit\n");
- fprintf (stdout, " %s -V \n", prog);
- fprintf (stdout, " Print HDF5 library version and exit\n");
+ HDfflush (stdout);
+ HDfprintf (stdout,
+ "usage: %s -i <in_file.h5> -u <in_user_file> [-o <out_file.h5>] [--clobber]\n", prog);
+ HDfprintf (stdout, "\n");
+ HDfprintf (stdout,
+ "Adds user block to front of an HDF5 file and creates a new concatenated file.\n");
+ HDfprintf (stdout, "\n");
+ HDfprintf (stdout,
+ "OPTIONS\n");
+ HDfprintf (stdout,
+ " -i in_file.h5 Specifies the input HDF5 file.\n");
+ HDfprintf (stdout,
+ " -u in_user_file Specifies the file to be inserted into the user block.\n");
+ HDfprintf (stdout,
+ " Can be any file format except an HDF5 format.\n");
+ HDfprintf (stdout,
+ " -o out_file.h5 Specifies the output HDF5 file.\n");
+ HDfprintf (stdout,
+ " If not specified, the user block will be concatenated in\n");
+ HDfprintf (stdout,
+ " place to the input HDF5 file.\n");
+ HDfprintf (stdout,
+ " --clobber Wipes out any existing user block before concatenating\n");
+ HDfprintf (stdout,
+ " the given user block.\n");
+ HDfprintf (stdout,
+ " The size of the new user block will be the larger of;\n");
+ HDfprintf (stdout,
+ " - the size of existing user block in the input HDF5 file\n");
+ HDfprintf (stdout,
+ " - the size of user block required by new input user file\n");
+ HDfprintf (stdout,
+ " (size = 512 x 2N, N is positive integer.)\n");
+ HDfprintf (stdout, "\n");
+ HDfprintf (stdout,
+ " -h Prints a usage message and exits.\n");
+ HDfprintf (stdout,
+ " -V Prints the HDF5 library version and exits.\n");
+ HDfprintf (stdout, "\n");
+ HDfprintf (stdout,
+ "Exit Status:\n");
+ HDfprintf (stdout,
+ " 0 Succeeded.\n");
+ HDfprintf (stdout,
+ " >0 An error occurred.\n");
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Shutdown and call exit()
+ *
+ * Return: Does not return
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+leave(int ret)
+{
+ if (ub_file)
+ HDfree (ub_file);
+ if (input_file)
+ HDfree (input_file);
+ if (output_file)
+ HDfree (output_file);
+ h5tools_close();
+
+ HDexit(ret);
}
/*-------------------------------------------------------------------------
@@ -111,30 +168,30 @@ parse_command_line (int argc, const char *argv[])
while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char) opt)
- {
- case 'o':
- output_file = HDstrdup (opt_arg);
- break;
- case 'i':
- input_file = HDstrdup (opt_arg);
- break;
- case 'u':
- ub_file = HDstrdup (opt_arg);
- break;
- case 'c':
- do_clobber = TRUE;
- break;
- case 'h':
- usage (h5tools_getprogname());
- exit (EXIT_SUCCESS);
- case 'V':
- print_version (h5tools_getprogname());
- exit (EXIT_SUCCESS);
- case '?':
- default:
- usage (h5tools_getprogname());
- exit (EXIT_FAILURE);
- }
+ {
+ case 'o':
+ output_file = HDstrdup (opt_arg);
+ break;
+ case 'i':
+ input_file = HDstrdup (opt_arg);
+ break;
+ case 'u':
+ ub_file = HDstrdup (opt_arg);
+ break;
+ case 'c':
+ do_clobber = TRUE;
+ break;
+ case 'h':
+ usage (h5tools_getprogname());
+ leave (EXIT_SUCCESS);
+ case 'V':
+ print_version (h5tools_getprogname());
+ leave (EXIT_SUCCESS);
+ case '?':
+ default:
+ usage (h5tools_getprogname());
+ leave (EXIT_FAILURE);
+ }
}
}
@@ -155,204 +212,208 @@ parse_command_line (int argc, const char *argv[])
int
main (int argc, const char *argv[])
{
- int ufid;
- int h5fid;
- int ofid;
- void *edata;
- H5E_auto2_t func;
- hid_t ifile;
- hid_t plist;
- herr_t status;
- htri_t testval;
- hsize_t usize;
- hsize_t h5fsize;
- hsize_t startub;
- hsize_t where;
- hsize_t newubsize;
- off_t fsize;
- h5_stat_t sbuf;
- h5_stat_t sbuf2;
- int res;
-
- h5tools_setprogname(PROGRAMNAME);
- h5tools_setstatus(EXIT_SUCCESS);
-
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+ int ufid = -1;
+ int h5fid = -1;
+ int ofid = -1;
+ void *edata;
+ H5E_auto2_t func;
+ hid_t ifile = -1;
+ hid_t plist = -1;
+ herr_t status;
+ htri_t testval;
+ hsize_t usize;
+ hsize_t h5fsize;
+ hsize_t startub;
+ hsize_t where;
+ hsize_t newubsize;
+ off_t fsize;
+ h5_stat_t sbuf;
+ h5_stat_t sbuf2;
+ int res;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &func, &edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ parse_command_line (argc, argv);
+
+ if (ub_file == NULL) {
+ /* no user block */
+ error_msg("missing arguemnt for -u <user_file>.\n");
+ help_ref_msg(stderr);
+ leave (EXIT_FAILURE);
+ }
- parse_command_line (argc, argv);
+ testval = H5Fis_hdf5 (ub_file);
- if (ub_file == NULL)
- {
- /* no user block */
- error_msg("no user block file name\n");
- usage (h5tools_getprogname());
- exit (EXIT_FAILURE);
+ if (testval > 0) {
+ error_msg("-u <user_file> cannot be HDF5 file, but it appears to be an HDF5 file.\n");
+ help_ref_msg(stderr);
+ leave (EXIT_FAILURE);
}
- if (input_file == NULL)
- {
- /* no user block */
- error_msg("no HDF5 file\n");
- usage (h5tools_getprogname());
- exit (EXIT_FAILURE);
+ if (input_file == NULL) {
+ error_msg("missing arguemnt for -i <HDF5 file>.\n");
+ help_ref_msg(stderr);
+ leave (EXIT_FAILURE);
}
- testval = H5Fis_hdf5 (input_file);
+ testval = H5Fis_hdf5 (input_file);
- if (testval <= 0)
- {
- error_msg("Input HDF5 file is not HDF \"%s\"\n", input_file);
- exit (EXIT_FAILURE);
+ if (testval <= 0) {
+ error_msg("Input HDF5 file \"%s\" is not HDF5 format.\n", input_file);
+ help_ref_msg(stderr);
+ leave (EXIT_FAILURE);
}
- ifile = H5Fopen (input_file, H5F_ACC_RDONLY, H5P_DEFAULT);
+ ifile = H5Fopen (input_file, H5F_ACC_RDONLY, H5P_DEFAULT);
- if (ifile < 0)
- {
- error_msg("Can't open input HDF5 file \"%s\"\n", input_file);
- exit (EXIT_FAILURE);
+ if (ifile < 0) {
+ error_msg("Can't open input HDF5 file \"%s\"\n", input_file);
+ leave (EXIT_FAILURE);
}
- plist = H5Fget_create_plist (ifile);
- if (plist < 0)
- {
- error_msg("Can't get file creation plist for file \"%s\"\n",
- input_file);
- exit (EXIT_FAILURE);
+ plist = H5Fget_create_plist (ifile);
+ if (plist < 0) {
+ error_msg("Can't get file creation plist for file \"%s\"\n", input_file);
+ H5Fclose(ifile);
+ leave (EXIT_FAILURE);
}
- status = H5Pget_userblock (plist, &usize);
- if (status < 0)
- {
- error_msg("Can't get user block for file \"%s\"\n",
- input_file);
- exit (EXIT_FAILURE);
+ status = H5Pget_userblock (plist, &usize);
+ if (status < 0) {
+ error_msg("Can't get user block for file \"%s\"\n", input_file);
+ H5Pclose(plist);
+ H5Fclose(ifile);
+ leave (EXIT_FAILURE);
}
- H5Pclose(plist);
- H5Fclose(ifile);
+ H5Pclose(plist);
+ H5Fclose(ifile);
- ufid = HDopen(ub_file, O_RDONLY, 0);
- if(ufid < 0) {
- error_msg("unable to open user block file \"%s\"\n",
- ub_file);
- exit (EXIT_FAILURE);
+ ufid = HDopen(ub_file, O_RDONLY, 0);
+ if(ufid < 0) {
+ error_msg("unable to open user block file \"%s\"\n", ub_file);
+ leave (EXIT_FAILURE);
}
- res = HDfstat(ufid, &sbuf);
- if(res < 0) {
- error_msg("Can't stat file \"%s\"\n", ub_file);
- exit (EXIT_FAILURE);
+ res = HDfstat(ufid, &sbuf);
+ if(res < 0) {
+ error_msg("Can't stat file \"%s\"\n", ub_file);
+ HDclose (ufid);
+ leave (EXIT_FAILURE);
}
- fsize = sbuf.st_size;
+ fsize = sbuf.st_size;
- h5fid = HDopen(input_file, O_RDONLY, 0);
- if(h5fid < 0) {
- error_msg("unable to open HDF5 file for read \"%s\"\n",
- input_file);
- exit (EXIT_FAILURE);
+ h5fid = HDopen(input_file, O_RDONLY, 0);
+ if(h5fid < 0) {
+ error_msg("unable to open HDF5 file for read \"%s\"\n", input_file);
+ HDclose (ufid);
+ leave (EXIT_FAILURE);
}
- res = HDfstat(h5fid, &sbuf2);
- if(res < 0) {
- error_msg("Can't stat file \"%s\"\n", input_file);
- exit (EXIT_FAILURE);
+ res = HDfstat(h5fid, &sbuf2);
+ if(res < 0) {
+ error_msg("Can't stat file \"%s\"\n", input_file);
+ HDclose (h5fid);
+ HDclose (ufid);
+ leave (EXIT_FAILURE);
}
- h5fsize = sbuf2.st_size;
+ h5fsize = sbuf2.st_size;
- if (output_file == NULL)
- {
- ofid = HDopen (input_file, O_WRONLY, 0);
-
- if (ofid < 0)
- {
- error_msg("unable to open output file \"%s\"\n",
- output_file);
- exit (EXIT_FAILURE);
- }
+ if (output_file == NULL) {
+ ofid = HDopen (input_file, O_WRONLY, 0);
+
+ if (ofid < 0) {
+ error_msg("unable to open output file \"%s\"\n", output_file);
+ HDclose (h5fid);
+ HDclose (ufid);
+ leave (EXIT_FAILURE);
+ }
}
- else
- {
- ofid = HDopen (output_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
-
- if (ofid < 0)
- {
- error_msg("unable to create output file \"%s\"\n",
- output_file);
- exit (EXIT_FAILURE);
- }
+ else {
+ ofid = HDopen (output_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+
+ if (ofid < 0) {
+ error_msg("unable to create output file \"%s\"\n", output_file);
+ HDclose (h5fid);
+ HDclose (ufid);
+ leave (EXIT_FAILURE);
+ }
}
- newubsize = compute_user_block_size ((hsize_t) fsize);
-
- startub = usize;
-
- if (usize > 0)
- {
- if (do_clobber == TRUE)
- {
- /* where is max of the current size or the new UB */
- if (usize > newubsize)
- {
- newubsize = usize;
- }
- startub = 0; /*blast the old */
- }
- else
- {
- /* add new ub to current ublock, pad to new offset */
- newubsize += usize;
- newubsize = compute_user_block_size ((hsize_t) newubsize);
- }
+ newubsize = compute_user_block_size ((hsize_t) fsize);
+
+ startub = usize;
+
+ if (usize > 0) {
+ if (do_clobber == TRUE) {
+ /* where is max of the current size or the new UB */
+ if (usize > newubsize) {
+ newubsize = usize;
+ }
+ startub = 0; /*blast the old */
+ }
+ else {
+ /* add new ub to current ublock, pad to new offset */
+ newubsize += usize;
+ newubsize = compute_user_block_size ((hsize_t) newubsize);
+ }
}
- /* copy the HDF5 from starting at usize to starting at newubsize:
- * makes room at 'from' for new ub */
- /* if no current ub, usize is 0 */
- copy_some_to_file (h5fid, ofid, usize, newubsize,
- (ssize_t) (h5fsize - usize));
+ /* copy the HDF5 from starting at usize to starting at newubsize:
+ * makes room at 'from' for new ub */
+ /* if no current ub, usize is 0 */
+ copy_some_to_file (h5fid, ofid, usize, newubsize, (ssize_t) (h5fsize - usize));
- /* copy the old ub to the beginning of the new file */
- if (!do_clobber)
- {
- where =
- copy_some_to_file (h5fid, ofid, (hsize_t) 0, (hsize_t) 0,
- (ssize_t) usize);
+ /* copy the old ub to the beginning of the new file */
+ if (!do_clobber) {
+ where = copy_some_to_file (h5fid, ofid, (hsize_t) 0, (hsize_t) 0, (ssize_t) usize);
}
- /* copy the new ub to the end of the ub */
- where = copy_some_to_file (ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1);
-
- /* pad the ub */
- where = write_pad (ofid, where);
+ /* copy the new ub to the end of the ub */
+ where = copy_some_to_file (ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1);
+ /* pad the ub */
+ where = write_pad (ofid, where);
- HDclose (ufid);
- HDclose (h5fid);
- HDclose (ofid);
+ if (ub_file)
+ HDfree (ub_file);
+ if (input_file)
+ HDfree (input_file);
+ if (output_file)
+ HDfree (output_file);
+
+ if (ufid >= 0) HDclose (ufid);
+ if (h5fid >= 0) HDclose (h5fid);
+ if (ofid >= 0) HDclose (ofid);
- return h5tools_getstatus();
+ return h5tools_getstatus();
}
/*-------------------------------------------------------------------------
* Function: copy_some_to_file
*
* Purpose: Copy part of the input file to output.
- * infid: fd of file to read
- * outfid: fd of file to write
- * startin: offset of where to read from infid
- * startout: offset of where to write to outfid
- * limit: bytes to read/write
+ * infid: fd of file to read
+ * outfid: fd of file to write
+ * startin: offset of where to read from infid
+ * startout: offset of where to write to outfid
+ * limit: bytes to read/write
*
- * If limit is < 0, the entire input file is copied.
+ * If limit is < 0, the entire input file is copied.
*
- * Note: this routine can be used to copy within
- * the same file, i.e., infid and outfid can be the
- * same file.
+ * Note: this routine can be used to copy within
+ * the same file, i.e., infid and outfid can be the
+ * same file.
*
* Return: Success: last byte written in the output.
* Failure: Exits program with EXIT_FAILURE value.
@@ -365,7 +426,7 @@ main (int argc, const char *argv[])
*/
hsize_t
copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
- ssize_t limit)
+ ssize_t limit)
{
char buf[1024];
h5_stat_t sbuf;
@@ -390,9 +451,9 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
if(limit < 0) {
res = HDfstat(infid, &sbuf);
if(res < 0) {
- error_msg("Can't stat file \n");
- exit (EXIT_FAILURE);
- }
+ error_msg("Can't stat file \n");
+ exit (EXIT_FAILURE);
+ }
howmuch = sbuf.st_size;
}
@@ -424,19 +485,19 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
HDlseek (infid, (off_t) from, SEEK_SET);
if (howmuch > 512)
- {
- nchars = HDread (infid, buf, (unsigned) 512);
- }
+ {
+ nchars = HDread (infid, buf, (unsigned) 512);
+ }
else
- {
- nchars = HDread (infid, buf, (unsigned)howmuch);
- }
+ {
+ nchars = HDread (infid, buf, (unsigned)howmuch);
+ }
if (nchars <= 0)
- {
- printf ("huh? \n");
- exit (EXIT_FAILURE);
- }
+ {
+ printf ("huh? \n");
+ exit (EXIT_FAILURE);
+ }
/*ncw = */ HDwrite (outfid, buf, (unsigned) nchars);
/* assert (ncw == nchars) */
@@ -444,15 +505,15 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
tot += nchars;
howmuch -= nchars;
if (howmuch > 512)
- {
- to -= nchars;
- from -= nchars;
- }
+ {
+ to -= nchars;
+ from -= nchars;
+ }
else
- {
- to -= howmuch;
- from -= howmuch;
- }
+ {
+ to -= howmuch;
+ from -= howmuch;
+ }
}
/* assert howmuch == 0 */
@@ -467,10 +528,10 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
*
* Purpose: Find the offset of the HDF5 header after the user block:
* align at 0, 512, 1024, etc.
- * ublock_size: the size of the user block (bytes).
+ * ublock_size: the size of the user block (bytes).
*
* Return: Success: the location of the header == the size of the
- * padded user block.
+ * padded user block.
* Failure: none
*
* Return: Success: last byte written in the output.
@@ -520,6 +581,6 @@ write_pad(int ofile, hsize_t where)
for(i = 0; i < psize; i++)
HDwrite (ofile, buf, 1);
- return(where + psize); /* the new size of the file. */
+ return(where + psize); /* the new size of the file. */
}
diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c
index ec79215..ca3d86c 100644
--- a/tools/h5jam/h5jamgentest.c
+++ b/tools/h5jam/h5jamgentest.c
@@ -310,18 +310,18 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
{
HDassert(ub_size <= BUF_SIZE);
- fd = HDopen(filename, O_RDWR, 0);
+ fd = HDopen(filename, O_RDWR, 0);
HDassert(fd >= 0);
- /* fill buf with pattern */
- HDmemset(buf, '\0', ub_size);
- bp = buf;
- for (u = 0; u < ub_fill; u++)
+ /* fill buf with pattern */
+ HDmemset(buf, '\0', ub_size);
+ bp = buf;
+ for (u = 0; u < ub_fill; u++)
*bp++ = pattern[u % 10];
- HDwrite(fd, buf, ub_size);
+ HDwrite(fd, buf, ub_size);
- HDclose(fd);
+ HDclose(fd);
}
}
@@ -334,9 +334,9 @@ create_textfile(const char *name, size_t size)
char *bp;
fd = HDcreat(name,0777);
- assert(fd >= 0);
- buf = calloc(size, (size_t)1);
- assert(buf);
+ HDassert(fd >= 0);
+ buf = HDcalloc(size, (size_t)1);
+ HDassert(buf);
/* fill buf with pattern */
bp = buf;
@@ -345,7 +345,7 @@ create_textfile(const char *name, size_t size)
HDwrite(fd, buf, size);
- free(buf);
+ HDfree(buf);
HDclose(fd);
}
@@ -363,7 +363,7 @@ create_binfile(char *name, off_t size)
fd = creat(name,0777);
HDassert(fd >= 0);
- buf = calloc(size,1);
+ buf = HDcalloc(size,1);
HDassert(buf);
/* fill buf with pattern */
diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c
index bfebc6c..4751dad 100644
--- a/tools/h5jam/h5unjam.c
+++ b/tools/h5jam/h5unjam.c
@@ -15,6 +15,7 @@
#include "hdf5.h"
#include "H5private.h"
+#include "h5tools.h"
#include "h5tools_utils.h"
/* Name of tool */
@@ -42,10 +43,10 @@ static const char *s_opts = "hu:i:o:d:V";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "hel", no_arg, 'h' },
- {"i", require_arg, 'i'}, /* input file */
- {"u", require_arg, 'u'}, /* user block file */
- {"o", require_arg, 'o'}, /* output file */
- {"delete", no_arg, 'd'}, /* delete ub */
+ {"i", require_arg, 'i'}, /* input file */
+ {"u", require_arg, 'u'}, /* user block file */
+ {"o", require_arg, 'o'}, /* output file */
+ {"delete", no_arg, 'd'}, /* delete ub */
{"delet", no_arg, 'd'},
{"dele", no_arg, 'd'},
{"del", no_arg, 'd'},
@@ -69,15 +70,80 @@ static struct long_options l_opts[] = {
static void
usage(const char *prog)
{
- fflush(stdout);
- fprintf(stdout, "usage: %s -i h5_file -o user_block_file_out -o h5_file_out [-d | --delete]\n", prog);
- fprintf(stdout, " Extract user block from 'h5_file' into 'user_block_file'\n");
- fprintf(stdout, " and HDF5 file into 'h5_file_out'\n");
-
- fprintf(stdout, " %s -h\n",prog);
- fprintf(stdout, " Print a usage message and exit\n");
- fprintf(stdout, " %s -V \n", prog);
- fprintf(stdout, " Print HDF5 library version and exit\n");
+ HDfflush(stdout);
+ HDfprintf(stdout,
+ "usage: %s -i <in_file.h5> [-o <out_file.h5> ] [-u <out_user_file> | --delete]\n", prog);
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout,
+ "Splits user file and HDF5 file into two files: user block data and HDF5 data.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout,
+ "OPTIONS\n");
+ HDfprintf(stdout,
+ " -i in_file.h5 Specifies the HDF5 as input. If the input HDF5 file\n");
+ HDfprintf(stdout,
+ " contains no user block, exit with an error message.\n");
+ HDfprintf(stdout,
+ " -o out_file.h5 Specifies output HDF5 file without a user block.\n");
+ HDfprintf(stdout,
+ " If not specified, the user block will be removed from the\n");
+ HDfprintf(stdout,
+ " input HDF5 file.\n");
+ HDfprintf(stdout,
+ " -u out_user_file\n");
+ HDfprintf(stdout,
+ " Specifies the output file containing the data from the\n");
+ HDfprintf(stdout,
+ " user block.\n");
+ HDfprintf(stdout,
+ " Cannot be used with --delete option.\n");
+ HDfprintf(stdout,
+ " --delete Remove the user block from the input HDF5 file. The content\n");
+ HDfprintf(stdout,
+ " of the user block is discarded.\n");
+ HDfprintf(stdout,
+ " Cannot be used with the -u option.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout,
+ " -h Prints a usage message and exits.\n");
+ HDfprintf(stdout,
+ " -V Prints the HDF5 library version and exits.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout,
+ " If neither --delete nor -u is specified, the user block from the input file\n");
+ HDfprintf(stdout,
+ " will be displayed to stdout.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout,
+ "Exit Status:\n");
+ HDfprintf(stdout,
+ " 0 Succeeded.\n");
+ HDfprintf(stdout,
+ " >0 An error occurred.\n");
+}
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Shutdown and call exit()
+ *
+ * Return: Does not return
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+leave(int ret)
+{
+ if (ub_file)
+ HDfree (ub_file);
+ if (input_file)
+ HDfree (input_file);
+ if (output_file)
+ HDfree (output_file);
+
+ h5tools_close();
+
+ HDexit(ret);
}
/*-------------------------------------------------------------------------
@@ -99,33 +165,33 @@ usage(const char *prog)
static void
parse_command_line(int argc, const char *argv[])
{
- int opt = FALSE;
+ int opt = FALSE;
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch ((char)opt) {
- case 'o':
- output_file = HDstrdup (opt_arg);
- break;
- case 'i':
- input_file = HDstrdup (opt_arg);
- break;
- case 'u':
- ub_file = HDstrdup (opt_arg);
- break;
- case 'd':
- do_delete = TRUE;
- break;
- case 'h':
- usage(h5tools_getprogname());
- exit(EXIT_SUCCESS);
- case 'V':
- print_version (h5tools_getprogname());
- exit (EXIT_SUCCESS);
- case '?':
- default:
- usage(h5tools_getprogname());
- exit(EXIT_FAILURE);
+ switch ((char) opt) {
+ case 'o':
+ output_file = HDstrdup (opt_arg);
+ break;
+ case 'i':
+ input_file = HDstrdup (opt_arg);
+ break;
+ case 'u':
+ ub_file = HDstrdup (opt_arg);
+ break;
+ case 'd':
+ do_delete = TRUE;
+ break;
+ case 'h':
+ usage(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ case 'V':
+ print_version(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ leave(EXIT_FAILURE);
}
}
@@ -134,7 +200,7 @@ parse_command_line(int argc, const char *argv[])
if (argc <= opt_ind+2) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
- exit(EXIT_FAILURE);
+ HDexit(EXIT_FAILURE);
}
*/
}
@@ -156,19 +222,19 @@ parse_command_line(int argc, const char *argv[])
int
main(int argc, const char *argv[])
{
- int ifid;
- int ufid;
- int h5fid;
+ int ifid = -1;
+ int ufid = -1;
+ int h5fid = -1;
void *edata;
- H5E_auto2_t func;
- hid_t ifile;
- off_t fsize;
- hsize_t usize;
- htri_t testval;
- herr_t status;
- hid_t plist;
- int res;
- h5_stat_t sbuf;
+ H5E_auto2_t func;
+ hid_t ifile = -1;
+ hid_t plist = -1;
+ off_t fsize;
+ hsize_t usize;
+ htri_t testval;
+ herr_t status;
+ int res;
+ h5_stat_t sbuf;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -179,67 +245,87 @@ main(int argc, const char *argv[])
parse_command_line(argc, argv);
+ if (input_file == NULL) {
+ /* no user block */
+ error_msg("missing arguemnt for HDF5 file input.\n");
+ help_ref_msg(stderr);
+ leave (EXIT_FAILURE);
+ }
+
testval = H5Fis_hdf5(input_file);
if (testval <= 0) {
- error_msg("Input HDF5 file is not HDF \"%s\"\n", input_file);
- exit(EXIT_FAILURE);
+ error_msg("Input HDF5 file \"%s\" is not HDF\n", input_file);
+ help_ref_msg (stderr);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
ifile = H5Fopen(input_file, H5F_ACC_RDONLY , H5P_DEFAULT);
if (ifile < 0) {
error_msg("Can't open input HDF5 file \"%s\"\n", input_file);
- exit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
plist = H5Fget_create_plist(ifile);
if (plist < 0) {
error_msg("Can't get file creation plist for file \"%s\"\n", input_file);
- exit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
- status = H5Pget_userblock(plist, & usize );
+ status = H5Pget_userblock(plist, & usize);
if (status < 0) {
error_msg("Can't get user block for file \"%s\"\n", input_file);
- exit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
+ H5Pclose(plist);
+ H5Fclose(ifile);
+
if (usize == 0) {
- /* no user block to remove: message? */
+ /* no user block to remove: message? */
error_msg("\"%s\" has no user block: no change to file\n", input_file);
- exit(EXIT_SUCCESS);
-
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
}
ifid = HDopen(input_file,O_RDONLY,0);
if(ifid < 0) {
error_msg("unable to open input HDF5 file \"%s\"\n", input_file);
- exit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
res = HDfstat(ifid, &sbuf);
if(res < 0) {
error_msg("Can't stat file \"%s\"\n", input_file);
- exit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
fsize = sbuf.st_size;
if (do_delete && (ub_file != NULL)) {
- error_msg("??\"%s\"\n", ub_file);
- exit(EXIT_FAILURE);
+ error_msg("??\"%s\"\n", ub_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
if (ub_file == NULL) {
- /* write to sdtout */
- ufid = HDdup(1);
- } else {
+ /* write to sdtout */
+ ufid = HDdup(1);
+ }
+ else {
ufid = HDopen(ub_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 );
if (ufid < 0) {
error_msg("unable to open user block file for output\"%s\"\n", ub_file);
- exit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
}
@@ -248,23 +334,27 @@ main(int argc, const char *argv[])
if (h5fid < 0) {
error_msg("unable to open output HDF5 file \"%s\"\n", input_file);
- exit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
- } else {
+ }
+ else {
h5fid = HDopen(output_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 );
if (h5fid < 0) {
error_msg("unable to open output HDF5 file \"%s\"\n", output_file);
- exit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
}
/* copy from 0 to 'usize - 1' into ufid */
if (!do_delete) {
- if(copy_to_file(ifid, ufid, 0, (ssize_t) usize) < 0) {
+ if(copy_to_file(ifid, ufid, 0, (ssize_t) usize) < 0) {
error_msg("unable to copy user block to output file \"%s\"\n", ub_file);
- exit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
}
@@ -273,13 +363,22 @@ main(int argc, const char *argv[])
*/
if(copy_to_file(ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) {
error_msg("unable to copy hdf5 data to output file \"%s\"\n", output_file);
- exit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
+done:
+ if (ub_file) {
+ HDfree (ub_file);
+ if (ufid >= 0) HDclose(ufid);
+ }
+ if (input_file)
+ HDfree (input_file);
+ if (output_file)
+ HDfree (output_file);
- HDclose(ufid);
- HDclose(h5fid);
- HDclose(ifid);
+ if (h5fid >= 0) HDclose(h5fid);
+ if (ifid >= 0) HDclose(ifid);
return h5tools_getstatus();
}
diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c
index f1b6756..0169d71 100644
--- a/tools/h5jam/tellub.c
+++ b/tools/h5jam/tellub.c
@@ -21,6 +21,7 @@
#include "hdf5.h"
#include "H5private.h"
+#include "h5tools.h"
#include "h5tools_utils.h"
#define TRUE 1
@@ -60,7 +61,7 @@ usage (const char *prog)
fflush (stdout);
fprintf (stdout, "usage: %s h5_file\n", prog);
fprintf (stdout,
- " Check that h5_fil is HDF5 file and print size of user block \n");
+ " Check that h5_fil is HDF5 file and print size of user block \n");
fprintf (stdout, " %s -h\n", prog);
fprintf (stdout, " Print a usage message and exit\n");
}
@@ -90,15 +91,15 @@ parse_command_line (int argc, const char *argv[])
while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char) opt)
- {
- case 'h':
- usage (h5tools_getprogname());
- exit (EXIT_SUCCESS);
- case '?':
- default:
- usage (h5tools_getprogname());
- exit (EXIT_FAILURE);
- }
+ {
+ case 'h':
+ usage (h5tools_getprogname());
+ exit (EXIT_SUCCESS);
+ case '?':
+ default:
+ usage (h5tools_getprogname());
+ exit (EXIT_FAILURE);
+ }
}
/* check for file name to be processed */
@@ -139,6 +140,9 @@ main (int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
+ /* Initialize h5tools lib */
+ h5tools_init();
+
/* Disable error reporting */
H5Eget_auto2(H5E_DEFAULT, &func, &edata);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@@ -174,7 +178,7 @@ main (int argc, const char *argv[])
if (plist < 0)
{
error_msg("Can't get file creation plist for file \"%s\"\n",
- ifname);
+ ifname);
return (EXIT_FAILURE);
}
diff --git a/tools/h5jam/testfiles/h5jam-help.txt b/tools/h5jam/testfiles/h5jam-help.txt
new file mode 100644
index 0000000..ce97c22
--- /dev/null
+++ b/tools/h5jam/testfiles/h5jam-help.txt
@@ -0,0 +1,24 @@
+usage: h5jam -i <in_file.h5> -u <in_user_file> [-o <out_file.h5>] [--clobber]
+
+Adds user block to front of an HDF5 file and creates a new concatenated file.
+
+OPTIONS
+ -i in_file.h5 Specifies the input HDF5 file.
+ -u in_user_file Specifies the file to be inserted into the user block.
+ Can be any file format except an HDF5 format.
+ -o out_file.h5 Specifies the output HDF5 file.
+ If not specified, the user block will be concatenated in
+ place to the input HDF5 file.
+ --clobber Wipes out any existing user block before concatenating
+ the given user block.
+ The size of the new user block will be the larger of;
+ - the size of existing user block in the input HDF5 file
+ - the size of user block required by new input user file
+ (size = 512 x 2N, N is positive integer.)
+
+ -h Prints a usage message and exits.
+ -V Prints the HDF5 library version and exits.
+
+Exit Status:
+ 0 Succeeded.
+ >0 An error occurred.
diff --git a/tools/h5jam/testfiles/h5jam-ub-nohdf5.txt b/tools/h5jam/testfiles/h5jam-ub-nohdf5.txt
new file mode 100644
index 0000000..72c0b17
--- /dev/null
+++ b/tools/h5jam/testfiles/h5jam-ub-nohdf5.txt
@@ -0,0 +1,2 @@
+h5jam error: -u <user_file> cannot be HDF5 file, but it appears to be an HDF5 file.
+Try '-h' or '--help' for more information or see the <h5jam> entry in the 'HDF5 Reference Manual'.
diff --git a/tools/h5jam/testfiles/h5unjam-help.txt b/tools/h5jam/testfiles/h5unjam-help.txt
new file mode 100644
index 0000000..f0d92e9
--- /dev/null
+++ b/tools/h5jam/testfiles/h5unjam-help.txt
@@ -0,0 +1,27 @@
+usage: h5unjam -i <in_file.h5> [-o <out_file.h5> ] [-u <out_user_file> | --delete]
+
+Splits user file and HDF5 file into two files: user block data and HDF5 data.
+
+OPTIONS
+ -i in_file.h5 Specifies the HDF5 as input. If the input HDF5 file
+ contains no user block, exit with an error message.
+ -o out_file.h5 Specifies output HDF5 file without a user block.
+ If not specified, the user block will be removed from the
+ input HDF5 file.
+ -u out_user_file
+ Specifies the output file containing the data from the
+ user block.
+ Cannot be used with --delete option.
+ --delete Remove the user block from the input HDF5 file. The content
+ of the user block is discarded.
+ Cannot be used with the -u option.
+
+ -h Prints a usage message and exits.
+ -V Prints the HDF5 library version and exits.
+
+ If neither --delete nor -u is specified, the user block from the input file
+ will be displayed to stdout.
+
+Exit Status:
+ 0 Succeeded.
+ >0 An error occurred.
diff --git a/tools/h5jam/testh5jam.sh.in b/tools/h5jam/testh5jam.sh.in
index cfefcdc..f359926 100644
--- a/tools/h5jam/testh5jam.sh.in
+++ b/tools/h5jam/testh5jam.sh.in
@@ -35,6 +35,7 @@ UNJAM_BIN=`pwd` # The path of the jam binary
CMP='cmp -s'
DIFF='diff -c'
AWK='awk'
+CP='cp'
nerrors=0
verbose=yes
@@ -43,8 +44,75 @@ verbose=yes
if test -z "$srcdir"; then
srcdir=.
fi
-TESTFILES="$srcdir/testfiles"
+# source dirs
+SRC_TOOLS="$srcdir/.."
+SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles"
+
+# testfiles source dirs for tools
+SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES"
+SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES"
+SRC_H5DIFF_TESTFILES="$SRC_TOOLS/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles"
+
+TESTDIR=./testfiles
+test -d $TESTDIR || mkdir $TESTDIR
+
+######################################################################
+# test files
+# --------------------------------------------------------------------
+# All the test files copy from source directory to test directory
+# NOTE: Keep this framework to add/remove test files.
+# Any test files from other tools can be used in this framework.
+# This list are also used for checking exist.
+# Comment '#' without space can be used.
+# --------------------------------------------------------------------
+LIST_HDF5_TEST_FILES="
+$SRC_H5JAM_TESTFILES/tall.h5
+$SRC_H5JAM_TESTFILES/twithub.h5
+$SRC_H5JAM_TESTFILES/twithub513.h5
+"
+LIST_OTHER_TEST_FILES="
+$SRC_H5JAM_TESTFILES/u10.txt
+$SRC_H5JAM_TESTFILES/u511.txt
+$SRC_H5JAM_TESTFILES/u512.txt
+$SRC_H5JAM_TESTFILES/u513.txt
+$SRC_H5JAM_TESTFILES/h5jam-help.txt
+$SRC_H5JAM_TESTFILES/h5unjam-help.txt
+$SRC_H5JAM_TESTFILES/h5jam-ub-nohdf5.txt
+"
+
+# Source in the output filter function definitions.
+. $srcdir/../../bin/output_filter.sh
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+COPY_TESTFILES_TO_TESTDIR()
+{
+ # copy test files. Used -f to make sure get a new copy
+ for tstfile in $COPY_TESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ if [ -a $tstfile ]; then
+ $CP -f $tstfile $TESTDIR
+ else
+ echo "Error: FAILED to copy $tstfile"
+ echo " $tstfile doesn't exist!"
+ exit $EXIT_FAILURE
+ fi
+ fi
+ done
+}
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
@@ -381,150 +449,219 @@ UNJAMTEST () {
}
+#
+# TOOLTEST_OUTPUT < JAM | UNJAM > expect-output.txt exit-code options
+#
+# Only verify stdout/stderr output from h5jam and j5unjam
+#
+
+TOOLTEST_OUTPUT() {
+ if [ "$1" == "JAM" ]; then
+ TOOLCMD=$JAM_BIN/$JAM
+ elif [ "$1" == "UNJAM" ]; then
+ TOOLCMD=$JAM_BIN/$UNJAM
+ fi
+ shift
+ expect="$TESTDIR/$1"
+ actual="$TESTDIR/`basename $1 .ls`.out"
+ actual_err="$TESTDIR/`basename $1 .ls`.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+ shift
+ retvalexpect=$1
+ shift
+
+ TESTING h5jam $@
+ (
+ cd $TESTDIR
+ $TOOLCMD "$@"
+ ) >$actual 2>$actual_err
+
+ # 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
+ # combine stderr to stdout for output compare
+ cat $actual_err >> $actual
+
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ rm -f $actual $actual_err
+ elif $CMP $expect $actual; then
+ echo " PASSED"
+ rm -f $actual $actual_err
+ else
+ echo "*FAILED*"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+}
+
##############################################################################
##############################################################################
### T H E T E S T S ###
##############################################################################
##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
-JAMTEST $TESTFILES/u10.txt $TESTFILES/tall.h5 ta2.h5
-CHECKFILE $TESTFILES/tall.h5 ta2.h5
+#-------------------------------
+# Testing h5jam
+#-------------------------------
+# help page
+TOOLTEST_OUTPUT JAM h5jam-help.txt 0 -h
+
+# don't allow HDF5 format file as an user block file
+TOOLTEST_OUTPUT JAM h5jam-ub-nohdf5.txt 1 -i tall.h5 -u tall.h5 -o tall-tmp.h5
+
+JAMTEST $TESTDIR/u10.txt $TESTDIR/tall.h5 ta2.h5
+CHECKFILE $TESTDIR/tall.h5 ta2.h5
CLEANUP ta2.h5
-JAMTEST $TESTFILES/u511.txt $TESTFILES/tall.h5 ta3.h5
-CHECKFILE $TESTFILES/tall.h5 ta3.h5
+JAMTEST $TESTDIR/u511.txt $TESTDIR/tall.h5 ta3.h5
+CHECKFILE $TESTDIR/tall.h5 ta3.h5
CLEANUP ta3.h5
-JAMTEST $TESTFILES/u512.txt $TESTFILES/tall.h5 ta4.h5
-CHECKFILE $TESTFILES/tall.h5 ta4.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/tall.h5 ta4.h5
+CHECKFILE $TESTDIR/tall.h5 ta4.h5
CLEANUP ta4.h5
-JAMTEST $TESTFILES/u513.txt $TESTFILES/tall.h5 ta5.h5
-CHECKFILE $TESTFILES/tall.h5 ta5.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/tall.h5 ta5.h5
+CHECKFILE $TESTDIR/tall.h5 ta5.h5
CLEANUP ta5.h5
-SETUP $TESTFILES/tall.h5 ta.h5
-JAMTEST $TESTFILES/u10.txt ta.h5
-CHECKFILE $TESTFILES/tall.h5 ta.h5
-SETUP $TESTFILES/tall.h5 ta.h5
-JAMTEST $TESTFILES/u511.txt ta.h5
-CHECKFILE $TESTFILES/tall.h5 ta.h5
-SETUP $TESTFILES/tall.h5 ta.h5
-JAMTEST $TESTFILES/u512.txt ta.h5
-CHECKFILE $TESTFILES/tall.h5 ta.h5
-SETUP $TESTFILES/tall.h5 ta.h5
-JAMTEST $TESTFILES/u513.txt ta.h5
-CHECKFILE $TESTFILES/tall.h5 ta.h5
+SETUP $TESTDIR/tall.h5 ta.h5
+JAMTEST $TESTDIR/u10.txt ta.h5
+CHECKFILE $TESTDIR/tall.h5 ta.h5
+SETUP $TESTDIR/tall.h5 ta.h5
+JAMTEST $TESTDIR/u511.txt ta.h5
+CHECKFILE $TESTDIR/tall.h5 ta.h5
+SETUP $TESTDIR/tall.h5 ta.h5
+JAMTEST $TESTDIR/u512.txt ta.h5
+CHECKFILE $TESTDIR/tall.h5 ta.h5
+SETUP $TESTDIR/tall.h5 ta.h5
+JAMTEST $TESTDIR/u513.txt ta.h5
+CHECKFILE $TESTDIR/tall.h5 ta.h5
CLEANUP ta.h5
-JAMTEST $TESTFILES/u10.txt $TESTFILES/twithub.h5 tax2.h5
-CHECKFILE $TESTFILES/tall.h5 tax2.h5
+JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 tax2.h5
+CHECKFILE $TESTDIR/tall.h5 tax2.h5
CLEANUP tax2.h5
-JAMTEST $TESTFILES/u511.txt $TESTFILES/twithub.h5 tax3.h5
-CHECKFILE $TESTFILES/tall.h5 tax3.h5
+JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub.h5 tax3.h5
+CHECKFILE $TESTDIR/tall.h5 tax3.h5
CLEANUP tax3.h5
-JAMTEST $TESTFILES/u512.txt $TESTFILES/twithub.h5 tax4.h5
-CHECKFILE $TESTFILES/tall.h5 tax4.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub.h5 tax4.h5
+CHECKFILE $TESTDIR/tall.h5 tax4.h5
CLEANUP tax4.h5
-JAMTEST $TESTFILES/u513.txt $TESTFILES/twithub.h5 tax5.h5
-CHECKFILE $TESTFILES/tall.h5 tax5.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub.h5 tax5.h5
+CHECKFILE $TESTDIR/tall.h5 tax5.h5
CLEANUP tax5.h5
-JAMTEST $TESTFILES/u10.txt $TESTFILES/twithub513.h5 tax6.h5
-CHECKFILE $TESTFILES/tall.h5 tax6.h5
+JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub513.h5 tax6.h5
+CHECKFILE $TESTDIR/tall.h5 tax6.h5
CLEANUP tax6.h5
-JAMTEST $TESTFILES/u511.txt $TESTFILES/twithub513.h5 tax7.h5
-CHECKFILE $TESTFILES/tall.h5 tax7.h5
+JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub513.h5 tax7.h5
+CHECKFILE $TESTDIR/tall.h5 tax7.h5
CLEANUP tax7.h5
-JAMTEST $TESTFILES/u512.txt $TESTFILES/twithub513.h5 tax8.h5
-CHECKFILE $TESTFILES/tall.h5 tax8.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub513.h5 tax8.h5
+CHECKFILE $TESTDIR/tall.h5 tax8.h5
CLEANUP tax8.h5
-JAMTEST $TESTFILES/u513.txt $TESTFILES/twithub513.h5 tax9.h5
-CHECKFILE $TESTFILES/tall.h5 tax9.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 tax9.h5
+CHECKFILE $TESTDIR/tall.h5 tax9.h5
CLEANUP tax9.h5
-JAMTEST $TESTFILES/u10.txt $TESTFILES/twithub.h5 --clobber taz2.h5
-CHECKFILE $TESTFILES/tall.h5 taz2.h5
+JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 --clobber taz2.h5
+CHECKFILE $TESTDIR/tall.h5 taz2.h5
CLEANUP taz2.h5
-JAMTEST $TESTFILES/u511.txt $TESTFILES/twithub.h5 --clobber taz3.h5
-CHECKFILE $TESTFILES/tall.h5 taz3.h5
+JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub.h5 --clobber taz3.h5
+CHECKFILE $TESTDIR/tall.h5 taz3.h5
CLEANUP taz3.h5
-JAMTEST $TESTFILES/u512.txt $TESTFILES/twithub.h5 --clobber taz4.h5
-CHECKFILE $TESTFILES/tall.h5 taz4.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub.h5 --clobber taz4.h5
+CHECKFILE $TESTDIR/tall.h5 taz4.h5
CLEANUP taz4.h5
-JAMTEST $TESTFILES/u513.txt $TESTFILES/twithub.h5 --clobber taz5.h5
-CHECKFILE $TESTFILES/tall.h5 taz5.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub.h5 --clobber taz5.h5
+CHECKFILE $TESTDIR/tall.h5 taz5.h5
CLEANUP taz5.h5
-JAMTEST $TESTFILES/u10.txt $TESTFILES/twithub513.h5 --clobber taz6.h5
-CHECKFILE $TESTFILES/tall.h5 taz6.h5
+JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub513.h5 --clobber taz6.h5
+CHECKFILE $TESTDIR/tall.h5 taz6.h5
CLEANUP taz6.h5
-JAMTEST $TESTFILES/u511.txt $TESTFILES/twithub513.h5 --clobber taz7.h5
-CHECKFILE $TESTFILES/tall.h5 taz7.h5
+JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub513.h5 --clobber taz7.h5
+CHECKFILE $TESTDIR/tall.h5 taz7.h5
CLEANUP taz7.h5
-JAMTEST $TESTFILES/u512.txt $TESTFILES/twithub513.h5 --clobber taz8.h5
-CHECKFILE $TESTFILES/tall.h5 taz8.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub513.h5 --clobber taz8.h5
+CHECKFILE $TESTDIR/tall.h5 taz8.h5
CLEANUP taz8.h5
-JAMTEST $TESTFILES/u513.txt $TESTFILES/twithub513.h5 --clobber taz9.h5
-CHECKFILE $TESTFILES/tall.h5 taz9.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 --clobber taz9.h5
+CHECKFILE $TESTDIR/tall.h5 taz9.h5
CLEANUP taz9.h5
-SETUP $TESTFILES/twithub.h5 tay2.h5
-JAMTEST $TESTFILES/u10.txt tay2.h5 --clobber
-CHECKFILE $TESTFILES/tall.h5 tay2.h5
+SETUP $TESTDIR/twithub.h5 tay2.h5
+JAMTEST $TESTDIR/u10.txt tay2.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay2.h5
CLEANUP tay2.h5
-SETUP $TESTFILES/twithub.h5 tay3.h5
-JAMTEST $TESTFILES/u511.txt tay3.h5 --clobber
-CHECKFILE $TESTFILES/tall.h5 tay3.h5
+SETUP $TESTDIR/twithub.h5 tay3.h5
+JAMTEST $TESTDIR/u511.txt tay3.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay3.h5
CLEANUP tay3.h5
-SETUP $TESTFILES/twithub.h5 tay4.h5
-JAMTEST $TESTFILES/u512.txt tay4.h5 --clobber
-CHECKFILE $TESTFILES/tall.h5 tay4.h5
+SETUP $TESTDIR/twithub.h5 tay4.h5
+JAMTEST $TESTDIR/u512.txt tay4.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay4.h5
CLEANUP tay4.h5
-SETUP $TESTFILES/twithub.h5 tay5.h5
-JAMTEST $TESTFILES/u513.txt tay5.h5 --clobber
-CHECKFILE $TESTFILES/tall.h5 tay5.h5
+SETUP $TESTDIR/twithub.h5 tay5.h5
+JAMTEST $TESTDIR/u513.txt tay5.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay5.h5
CLEANUP tay5.h5
-SETUP $TESTFILES/twithub513.h5 tay6.h5
-JAMTEST $TESTFILES/u10.txt tay6.h5 --clobber
-CHECKFILE $TESTFILES/tall.h5 tay6.h5
+SETUP $TESTDIR/twithub513.h5 tay6.h5
+JAMTEST $TESTDIR/u10.txt tay6.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay6.h5
CLEANUP tay6.h5
-SETUP $TESTFILES/twithub513.h5 tay7.h5
-JAMTEST $TESTFILES/u511.txt tay7.h5 --clobber
-CHECKFILE $TESTFILES/tall.h5 tay7.h5
+SETUP $TESTDIR/twithub513.h5 tay7.h5
+JAMTEST $TESTDIR/u511.txt tay7.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay7.h5
CLEANUP tay7.h5
-SETUP $TESTFILES/twithub513.h5 tay8.h5
-JAMTEST $TESTFILES/u512.txt tay8.h5 --clobber
-CHECKFILE $TESTFILES/tall.h5 tay8.h5
+SETUP $TESTDIR/twithub513.h5 tay8.h5
+JAMTEST $TESTDIR/u512.txt tay8.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay8.h5
CLEANUP tay8.h5
-SETUP $TESTFILES/twithub513.h5 tay9.h5
-JAMTEST $TESTFILES/u513.txt tay9.h5 --clobber
-CHECKFILE $TESTFILES/tall.h5 tay9.h5
+SETUP $TESTDIR/twithub513.h5 tay9.h5
+JAMTEST $TESTDIR/u513.txt tay9.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay9.h5
CLEANUP tay9.h5
-SETUP $TESTFILES/twithub.h5 tai1.h5
+#---------------------------------
+# Testing h5unjam
+#---------------------------------
+# help page
+TOOLTEST_OUTPUT UNJAM h5unjam-help.txt 0 -h
+
+SETUP $TESTDIR/twithub.h5 tai1.h5
UNJAMTEST tai1.h5 o10.txt taa1.h5
-CHECKFILE $TESTFILES/tall.h5 taa1.h5
+CHECKFILE $TESTDIR/tall.h5 taa1.h5
CLEANUP taa1.h5 tai1.h5 o10.txt
-SETUP $TESTFILES/twithub513.h5 tai2.h5
+SETUP $TESTDIR/twithub513.h5 tai2.h5
UNJAMTEST tai2.h5 o512.txt taa2.h5
-CHECKFILE $TESTFILES/tall.h5 taa2.h5
+CHECKFILE $TESTDIR/tall.h5 taa2.h5
CLEANUP taa2.h5 tai2.h5 o512.txt
-SETUP $TESTFILES/twithub.h5 tai3.h5
+SETUP $TESTDIR/twithub.h5 tai3.h5
UNJAMTEST tai3.h5 - taa3.h5
-CHECKFILE $TESTFILES/tall.h5 taa3.h5
+CHECKFILE $TESTDIR/tall.h5 taa3.h5
CLEANUP taa3.h5 tai3.h5
-SETUP $TESTFILES/twithub513.h5 tai4.h5
+SETUP $TESTDIR/twithub513.h5 tai4.h5
UNJAMTEST tai4.h5 - taa4.h5
-CHECKFILE $TESTFILES/tall.h5 taa4.h5
+CHECKFILE $TESTDIR/tall.h5 taa4.h5
CLEANUP taa4.h5 tai4.h5
-SETUP $TESTFILES/twithub.h5 taj2.h5
+SETUP $TESTDIR/twithub.h5 taj2.h5
UNJAMTEST taj2.h5 --delete tac2.h5
-CHECKFILE $TESTFILES/tall.h5 tac2.h5
+CHECKFILE $TESTDIR/tall.h5 tac2.h5
CLEANUP tac2.h5 taj2.h5
-SETUP $TESTFILES/twithub513.h5 taj3.h5
+SETUP $TESTDIR/twithub513.h5 taj3.h5
UNJAMTEST taj3.h5 --delete tac3.h5
-CHECKFILE $TESTFILES/tall.h5 tac3.h5
+CHECKFILE $TESTDIR/tall.h5 tac3.h5
CLEANUP tac3.h5 taj3.h5