summaryrefslogtreecommitdiffstats
path: root/tools/misc
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-01-28 13:11:38 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-01-28 13:11:38 (GMT)
commit3360c3af0c100ac4d3a2fe2865f34661da862ec5 (patch)
tree9caf7dba62679504aa39ec02ebb72d8b8b5a848d /tools/misc
parent5b4d3279099e7e4fad6e0092c77aa93dfd35d616 (diff)
downloadhdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.zip
hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.gz
hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.bz2
[svn-r18175] Description:
Bring r17986:18172 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'tools/misc')
-rw-r--r--tools/misc/Makefile.in8
-rwxr-xr-xtools/misc/h5cc.in8
-rw-r--r--tools/misc/h5mkgrp.c2
-rwxr-xr-xtools/misc/h5redeploy.in18
-rw-r--r--tools/misc/h5repart.c56
-rw-r--r--tools/misc/h5repart_gentest.c20
-rw-r--r--tools/misc/testh5mkgrp.sh13
-rw-r--r--tools/misc/testh5repart.sh.in16
8 files changed, 80 insertions, 61 deletions
diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in
index a3d3e23..0b8ccb6 100644
--- a/tools/misc/Makefile.in
+++ b/tools/misc/Makefile.in
@@ -370,12 +370,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -969,7 +969,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -1040,7 +1040,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in
index 28f0dee..c274f3f 100755
--- a/tools/misc/h5cc.in
+++ b/tools/misc/h5cc.in
@@ -38,6 +38,10 @@ HL="@HL@"
## ##
############################################################################
+# Constants definitions
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
host_os="@host_os@"
prog_name="`basename $0`"
@@ -95,7 +99,7 @@ usage() {
echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library"
echo " [default: no]"
echo " "
- exit 1
+ exit $EXIT_FAILURE
}
# Show the configuration summary of the library recorded in the
@@ -107,7 +111,7 @@ showconfigure()
}
# Main
-status=0
+status=$EXIT_SUCCESS
if test "$#" = "0"; then
# No parameters specified, issue usage statement and exit.
diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c
index 1452a64..a6fdc56 100644
--- a/tools/misc/h5mkgrp.c
+++ b/tools/misc/h5mkgrp.c
@@ -319,6 +319,6 @@ main(int argc, const char *argv[])
/* Shut down h5tools lib */
h5tools_close();
- return 0;
+ return EXIT_SUCCESS;
} /* end main() */
diff --git a/tools/misc/h5redeploy.in b/tools/misc/h5redeploy.in
index 6abca62..ae79b70 100755
--- a/tools/misc/h5redeploy.in
+++ b/tools/misc/h5redeploy.in
@@ -18,6 +18,10 @@
## in a new location.
## For help page, use "h5redeploy -help"
+# Constants definitions
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
# Function definitions
# show help page
@@ -34,7 +38,7 @@ usage() {
echo " directory and writable. [default: $h5tools]"
echo " -show Show the commands without executing them"
echo " "
- exit 1
+ exit $EXIT_FAILURE
}
# display variable values
@@ -96,7 +100,7 @@ for arg in $@ ; do
*)
ERROR "Unknown Option($arg)"
usage
- exit 1
+ exit $EXIT_FAILURE
;;
esac
done
@@ -104,7 +108,7 @@ done
# Sanity checks
if [ ! -d $prefix ]; then
ERROR "prefix($prefix) is not an existing directory"
- exit 1
+ exit $EXIT_FAILURE
fi
for x in $h5tools; do
@@ -112,14 +116,14 @@ for x in $h5tools; do
foundtools="$foundtools $x"
if [ ! -w $x ]; then
ERROR "h5tool($x) is not writable"
- exit 1
+ exit $EXIT_FAILURE
fi
fi
done
if [ -z "$foundtools" ]; then
ERROR "found no tools to modify"
- exit 1
+ exit $EXIT_FAILURE
fi
# Show actions to be taken and get consent
@@ -131,7 +135,7 @@ if [ x-$fmode = x- ]; then
ans=`echo $ansx | tr "[A-Z]" "[a-z]"`
if [ x-$ans != x-yes ]; then
echo ABORT. No tools changed.
- exit 1
+ exit $EXIT_FAILURE
fi
fi
@@ -166,7 +170,7 @@ done
# Cleanup
rm -f $CMDFILE
-exit 0
+exit $EXIT_SUCCESS
# Some possible future features to add
# CCBASE - Name of the alternative C compiler
diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c
index 91df7b6..d41dfc9 100644
--- a/tools/misc/h5repart.c
+++ b/tools/misc/h5repart.c
@@ -98,7 +98,7 @@ usage (const char *progname)
"`k' for kB.\n");
fprintf(stderr, "File family names include an integer printf "
"format such as `%%d'\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
@@ -238,7 +238,7 @@ main (int argc, char *argv[])
} else if (!strcmp(argv[argno], "-V")) {
printf("This is %s version %u.%u release %u\n",
prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
- exit(0);
+ exit(EXIT_SUCCESS);
} else if (!strcmp (argv[argno], "-family_to_sec2")) {
family_to_sec2 = TRUE;
argno++;
@@ -262,12 +262,12 @@ main (int argc, char *argv[])
if ((src=HDopen(src_name, O_RDONLY,0))<0) {
perror (src_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDfstat(src, &sb)<0) {
perror ("fstat");
- exit (1);
+ exit (EXIT_FAILURE);
}
src_size = src_act_size = sb.st_size;
if (verbose) fprintf (stderr, "< %s\n", src_name);
@@ -282,7 +282,7 @@ main (int argc, char *argv[])
if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) {
perror (dst_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (verbose) fprintf (stderr, "> %s\n", dst_name);
@@ -308,10 +308,10 @@ main (int argc, char *argv[])
n = (size_t)MIN ((off_t)n, src_act_size-src_offset);
if ((nio=HDread (src, buf, n))<0) {
perror ("read");
- exit (1);
+ exit (EXIT_FAILURE);
} else if ((size_t)nio!=n) {
fprintf (stderr, "%s: short read\n", src_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
for (i=0; i<n; i++) {
if (buf[i]) break;
@@ -331,14 +331,14 @@ main (int argc, char *argv[])
if (need_write) {
if (need_seek && HDlseek (dst, dst_offset, SEEK_SET)<0) {
perror ("HDlseek");
- exit (1);
+ exit (EXIT_FAILURE);
}
if ((nio=HDwrite (dst, buf, n))<0) {
perror ("write");
- exit (1);
+ exit (EXIT_FAILURE);
} else if ((size_t)nio!=n) {
fprintf (stderr, "%s: short write\n", dst_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
need_seek = FALSE;
} else {
@@ -366,11 +366,11 @@ main (int argc, char *argv[])
break;
} else if (src<0) {
perror (src_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDfstat (src, &sb)<0) {
perror ("fstat");
- exit (1);
+ exit (EXIT_FAILURE);
}
src_act_size = sb.st_size;
if (src_act_size>src_size) {
@@ -391,26 +391,26 @@ main (int argc, char *argv[])
if (0==dst_membno) {
if (HDlseek (dst, dst_size-1, SEEK_SET)<0) {
perror ("HDHDlseek");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDread (dst, buf, 1)<0) {
perror ("read");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDlseek (dst, dst_size-1, SEEK_SET)<0) {
perror ("HDlseek");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDwrite (dst, buf, 1)<0) {
perror ("write");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
HDclose (dst);
sprintf (dst_name, dst_gen_name, ++dst_membno);
if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) {
perror (dst_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
dst_offset = 0;
need_seek = FALSE;
@@ -426,19 +426,19 @@ main (int argc, char *argv[])
if (need_seek) {
if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) {
perror ("HDlseek");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDread (dst, buf, 1)<0) {
perror ("read");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) {
perror ("HDlseek");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDwrite (dst, buf, 1)<0) {
perror ("write");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
HDclose (dst);
@@ -447,7 +447,7 @@ main (int argc, char *argv[])
* These private properties are for this tool only. */
if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) {
perror ("H5Pcreate");
- exit (1);
+ exit (EXIT_FAILURE);
}
if(family_to_sec2) {
@@ -456,7 +456,7 @@ main (int argc, char *argv[])
* driver information saved in the superblock. */
if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) {
perror ("H5Pset");
- exit (1);
+ exit (EXIT_FAILURE);
}
} else {
/* Modify family size saved in superblock through private property. It signals
@@ -464,14 +464,14 @@ main (int argc, char *argv[])
* This private property is for this tool only. */
if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) {
perror ("H5Pset_fapl_family");
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Set the property of the new member size as hsize_t */
hdsize = dst_size;
if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) {
perror ("H5Pset");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
@@ -488,16 +488,16 @@ main (int argc, char *argv[])
if(file>=0) {
if(H5Fclose(file)<0) {
perror ("H5Fclose");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
if(H5Pclose(fapl)<0) {
perror ("H5Pclose");
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Free resources and return */
free (buf);
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c
index 9fcc9c8..8420da5 100644
--- a/tools/misc/h5repart_gentest.c
+++ b/tools/misc/h5repart_gentest.c
@@ -39,29 +39,29 @@ int main(void)
/* Set property list and file name for FAMILY driver */
if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) {
perror ("H5Pcreate");
- exit (1);
+ exit (EXIT_FAILURE);
}
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) {
perror ("H5Pset_fapl_family");
- exit (1);
+ exit (EXIT_FAILURE);
}
if((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
perror("H5Fcreate");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Create and write dataset */
if((space = H5Screate_simple(2, dims, NULL)) < 0) {
perror("H5Screate_simple");
- exit(1);
+ exit(EXIT_FAILURE);
}
if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
perror("H5Dcreate2");
- exit(1);
+ exit(EXIT_FAILURE);
}
@@ -71,28 +71,28 @@ int main(void)
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
perror("H5Dwrite");
- exit(1);
+ exit(EXIT_FAILURE);
}
if(H5Sclose(space) < 0) {
perror ("H5Sclose");
- exit (1);
+ exit (EXIT_FAILURE);
}
if(H5Dclose(dset) < 0) {
perror ("H5Dclose");
- exit (1);
+ exit (EXIT_FAILURE);
}
if(H5Pclose(fapl) < 0) {
perror ("H5Pclose");
- exit (1);
+ exit (EXIT_FAILURE);
}
if(H5Fclose(file) < 0) {
perror ("H5Fclose");
- exit (1);
+ exit (EXIT_FAILURE);
}
puts(" PASSED"); fflush(stdout);
diff --git a/tools/misc/testh5mkgrp.sh b/tools/misc/testh5mkgrp.sh
index 50ac23b..e6cb96e 100644
--- a/tools/misc/testh5mkgrp.sh
+++ b/tools/misc/testh5mkgrp.sh
@@ -19,6 +19,10 @@
# Tuesday, February 13, 2007
#
+TESTNAME=h5mkgrp
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
H5MKGRP=h5mkgrp # The tool name
H5MKGRP_BIN=`pwd`/$H5MKGRP # The path of the tool binary
H5LS=h5ls # The h5ls tool name
@@ -182,8 +186,9 @@ RUNTEST h5mkgrp_nested_mult_latest.h5 "-lp" /one/two /three/four
if test $nerrors -eq 0 ; then
- echo "All h5mkgrp tests passed."
+ echo "All $TESTNAME tests passed."
+ exit $EXIT_SUCCESS
+else
+ echo "$TESTNAME tests failed with $nerrors errors."
+ exit $EXIT_FAILURE
fi
-
-exit $nerrors
-
diff --git a/tools/misc/testh5repart.sh.in b/tools/misc/testh5repart.sh.in
index 62c99d7..7d4e020 100644
--- a/tools/misc/testh5repart.sh.in
+++ b/tools/misc/testh5repart.sh.in
@@ -15,6 +15,10 @@
#
# Tests for the h5repart tool
+TESTNAME=h5repart
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
REPART=h5repart # The tool name
REPART_BIN=`pwd`/$REPART # The path of the tool binary
@@ -100,14 +104,16 @@ TOOLTEST -m 20000 -family_to_sec2 family_file%05d.h5 $actual_dir/family_to_sec2.
OUTPUTTEST
echo
-if test $nerrors -eq 0 ; then
- echo "All $REPART tests passed."
-fi
-
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
cd $actual_dir
rm -f fst_family*.h5 scd_family*.h5 family_to_sec2.h5
fi
-exit $nerrors
+if test $nerrors -eq 0 ; then
+ echo "All $TESTNAME tests passed."
+ exit $EXIT_SUCCESS
+else
+ echo "$TESTNAME tests failed with $nerrors errors."
+ exit $EXIT_FAILURE
+fi