summaryrefslogtreecommitdiffstats
path: root/tools/misc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/misc')
-rw-r--r--tools/misc/CMakeLists.txt150
-rw-r--r--tools/misc/Makefile.in2
-rw-r--r--tools/misc/h5mkgrp.c39
3 files changed, 172 insertions, 19 deletions
diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt
new file mode 100644
index 0000000..321d0f0
--- /dev/null
+++ b/tools/misc/CMakeLists.txt
@@ -0,0 +1,150 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_MISC)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the misc and test executables
+# --------------------------------------------------------------------
+#-- Misc Executables
+ADD_EXECUTABLE (h5debug ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5debug.c)
+H5_NAMING (h5debug)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5debug
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5debug ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ADD_EXECUTABLE (h5repart ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart.c)
+H5_NAMING (h5repart)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5repart
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5repart ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ADD_EXECUTABLE (h5mkgrp ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5mkgrp.c)
+H5_NAMING (h5mkgrp)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5mkgrp
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5mkgrp ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES
+ h5debug
+ h5repart
+ h5mkgrp
+)
+
+IF (BUILD_TESTING)
+ SET (HDF5_REFERENCE_TEST_FILES
+ family_file00000.h5
+ family_file00001.h5
+ family_file00002.h5
+ family_file00003.h5
+ family_file00004.h5
+ family_file00005.h5
+ family_file00006.h5
+ family_file00007.h5
+ family_file00008.h5
+ family_file00009.h5
+ family_file00010.h5
+ family_file00011.h5
+ family_file00012.h5
+ family_file00013.h5
+ family_file00014.h5
+ family_file00015.h5
+ family_file00016.h5
+ family_file00017.h5
+ )
+
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5repart
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5repart_gentest ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart_gentest.c)
+ H5_NAMING (h5repart_gentest)
+ IF (WIN32)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (h5repart_gentest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ #ADD_TEST (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>)
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ ADD_EXECUTABLE (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c)
+ H5_NAMING (h5repart_test)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5repart_test
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ # repartition family member size to 20,000 bytes.
+ ADD_TEST (NAME h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5)
+ # repartition family member size to 5 KB.
+ ADD_TEST (NAME h5repart_5K COMMAND $<TARGET_FILE:h5repart> -m 5k family_file%05d.h5 scd_family%05d.h5)
+ # convert family file to sec2 file of 20,000 bytes
+ ADD_TEST (NAME h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5)
+
+ # test the output files repartitioned above.
+ ADD_TEST (NAME h5repart_test COMMAND $<TARGET_FILE:h5repart_test>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5repart_gentest
+ h5repart_test
+ )
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5debug h5repart
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ toolsapplications
+)
diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in
index 1ad6097..4a2c7a8 100644
--- a/tools/misc/Makefile.in
+++ b/tools/misc/Makefile.in
@@ -240,12 +240,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c
index a6fdc56..09f23ef 100644
--- a/tools/misc/h5mkgrp.c
+++ b/tools/misc/h5mkgrp.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
/* Name of tool */
-const char *progname = "h5mkgrp";
+#define PROGRAMNAME "h5mkgrp"
/* Exit status for tools library routines */
int d_status = EXIT_SUCCESS;
@@ -141,7 +141,7 @@ parse_command_line(int argc, const char *argv[], param_t *params)
/* Display version */
case 'V':
- print_version(progname);
+ print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
/* Bad command line argument */
@@ -153,7 +153,7 @@ parse_command_line(int argc, const char *argv[], param_t *params)
/* Check for file name to be processed */
if(argc <= opt_ind) {
- error_msg(progname, "missing file name\n");
+ error_msg("missing file name\n");
usage();
leave(EXIT_FAILURE);
} /* end if */
@@ -164,7 +164,7 @@ parse_command_line(int argc, const char *argv[], param_t *params)
/* Check for group(s) to be created */
if(argc <= opt_ind) {
- error_msg(progname, "missing group name(s)\n");
+ error_msg("missing group name(s)\n");
usage();
leave(EXIT_FAILURE);
} /* end if */
@@ -212,6 +212,9 @@ main(int argc, const char *argv[])
hid_t lcpl_id; /* Link creation property list ID */
size_t curr_group; /* Current group to create */
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
/* Disable the HDF5 library's error reporting */
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@@ -221,13 +224,13 @@ main(int argc, const char *argv[])
/* Parse command line */
HDmemset(&params, 0, sizeof(params));
if(parse_command_line(argc, argv, &params) < 0) {
- error_msg(progname, "unable to parse command line arguments\n");
+ error_msg("unable to parse command line arguments\n");
leave(EXIT_FAILURE);
} /* end if */
/* Create file access property list */
if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- error_msg(progname, "Could not create file access property list\n");
+ error_msg("Could not create file access property list\n");
leave(EXIT_FAILURE);
} /* end if */
@@ -235,13 +238,13 @@ main(int argc, const char *argv[])
if(params.latest) {
/* Set the "use the latest version of the format" bounds */
if(H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
- error_msg(progname, "Could not set property for using latest version of the format\n");
+ error_msg("Could not set property for using latest version of the format\n");
leave(EXIT_FAILURE);
} /* end if */
/* Display some output if requested */
if(params.verbose)
- printf("%s: Creating groups with latest version of the format\n", progname);
+ printf("%s: Creating groups with latest version of the format\n", h5tools_getprogname());
} /* end if */
/* Attempt to open an existing HDF5 file first */
@@ -254,13 +257,13 @@ main(int argc, const char *argv[])
/* Test for error in opening file */
if(fid < 0) {
- error_msg(progname, "Could not open output file '%s'\n", params.fname);
+ error_msg("Could not open output file '%s'\n", params.fname);
leave(EXIT_FAILURE);
} /* end if */
/* Create link creation property list */
if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
- error_msg(progname, "Could not create link creation property list\n");
+ error_msg("Could not create link creation property list\n");
leave(EXIT_FAILURE);
} /* end if */
@@ -268,13 +271,13 @@ main(int argc, const char *argv[])
if(params.parents) {
/* Set the intermediate group creation property */
if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) {
- error_msg(progname, "Could not set property for creating parent groups\n");
+ error_msg("Could not set property for creating parent groups\n");
leave(EXIT_FAILURE);
} /* end if */
/* Display some output if requested */
if(params.verbose)
- printf("%s: Creating parent groups\n", progname);
+ printf("%s: Creating parent groups\n", h5tools_getprogname());
} /* end if */
/* Loop over creating requested groups */
@@ -283,36 +286,36 @@ main(int argc, const char *argv[])
/* Attempt to create a group */
if((gid = H5Gcreate2(fid, params.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- error_msg(progname, "Could not create group '%s'\n", params.groups[curr_group]);
+ error_msg("Could not create group '%s'\n", params.groups[curr_group]);
leave(EXIT_FAILURE);
} /* end if */
/* Close the group */
if(H5Gclose(gid) < 0) {
- error_msg(progname, "Could not close group '%s'??\n", params.groups[curr_group]);
+ error_msg("Could not close group '%s'??\n", params.groups[curr_group]);
leave(EXIT_FAILURE);
} /* end if */
/* Display some output if requested */
if(params.verbose)
- printf("%s: created group '%s'\n", progname, params.groups[curr_group]);
+ printf("%s: created group '%s'\n", h5tools_getprogname(), params.groups[curr_group]);
} /* end for */
/* Close link creation property list */
if(H5Pclose(lcpl_id) < 0) {
- error_msg(progname, "Could not close link creation property list\n");
+ error_msg("Could not close link creation property list\n");
leave(EXIT_FAILURE);
} /* end if */
/* Close file */
if(H5Fclose(fid) < 0) {
- error_msg(progname, "Could not close output file '%s'??\n", params.fname);
+ error_msg("Could not close output file '%s'??\n", params.fname);
leave(EXIT_FAILURE);
} /* end if */
/* Close file access property list */
if(H5Pclose(fapl_id) < 0) {
- error_msg(progname, "Could not close file access property list\n");
+ error_msg("Could not close file access property list\n");
leave(EXIT_FAILURE);
} /* end if */