hdf5/tools/misc/testh5repart.sh.in

117 lines
3.1 KiB
Bash
Raw Normal View History

#! /bin/sh
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the files COPYING and Copyright.html. COPYING can be found at the root
# of the source code distribution tree; Copyright.html can be found at the
# root level of an installed copy of the electronic HDF5 document set and
# is linked from the top-level documents page. It can also be found at
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
# access to either file, you may request a copy from help@hdfgroup.org.
#
# Tests for the h5repart tool
srcdir=@srcdir@
TESTNAME=h5repart
EXIT_SUCCESS=0
EXIT_FAILURE=1
REPART=h5repart # The tool name
REPART_BIN=`pwd`/$REPART # The path of the tool binary
REPARTED_FAM=repart_test # The test name
REPARTED_FAM_BIN=`pwd`/$REPARTED_FAM # The path of the test binary
nerrors=0
verbose=yes
test -d ../testfiles || mkdir ../testfiles
actual_dir=`pwd`/../testfiles
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
#
TESTING() {
SPACES=" "
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}
# Run a test and print PASS or *FAIL*. If a test fails then increment
# the `nerrors' global variable.
#
TOOLTEST() {
# Run tool test.
TESTING $REPART $@
(
# echo
cd $srcdir/../testfiles
$RUNSERIAL $REPART_BIN $@
)
if test $? -eq 0; then
echo " PASSED"
else
echo " FAILED"
nerrors=`expr $nerrors + 1`
fi
}
OUTPUTTEST() {
# Run test program.
TESTING $REPARTED_FAM $@
(
cd $actual_dir
$RUNSERIAL $REPARTED_FAM_BIN $@
)
if test $? -eq 0; then
echo " PASSED"
else
echo " FAILED"
nerrors=`expr $nerrors + 1`
fi
}
# Print a "SKIP" message
SKIP() {
TESTING $REPART $@
echo " -SKIP-"
}
##############################################################################
##############################################################################
### T H E T E S T S ###
##############################################################################
##############################################################################
# repartition family member size to 20,000 bytes.
TOOLTEST -m 20000 family_file%05d.h5 $actual_dir/fst_family%05d.h5
# repartition family member size to 5 KB.
TOOLTEST -m 5k family_file%05d.h5 $actual_dir/scd_family%05d.h5
[svn-r10971] Purpose: Bug fix Description: See details from Bug #213. Family member file size wasn't saved anywhere in file. When family file is opened, the first member size determine the member size. Solution: Hopefully, this is the last step of checkin for this stage. This step mainly enables h5repart tool to be able to convert file driver from family to sec2. Because the library saves family information in file, in trying to convert to sec2 driver, the library simply change the address of driver information to undefined so that the driver information block can be ignored. This step also updates the reference manual of H5Pset_fapl_family() and h5repart. In the fifth step of checkin, backward compatibility with v1.6 is tested. A family file created was created with the v1.6 library and opened with this version of the library. In the fourth step of checkin, a test suit is added for h5repart, including a program to generate the test files, a script file to run h5repart, and a program to verify repartitioned files can be opened by the library. There's a change from the first step of checkin. Family name template is no longer saved in the superblock because different pathname can make the name different. In the third step of checkin, h5repart has been modified. If h5repart is used to change the size of family member file, the new size(actual member size) is saved in the superblock. In the second step of checkin, multi driver is checked against the driver name saved in superblock. Wrong driver will result in a failure with an error message indicating multi driver should be used. This change includes split driver because it's a special case for multi driver. In the first step of checkin. Family member size and name template(unused at this stage) are saved in file superblock. When file is reopened,the size passed in thrin superblock. A different size will trigger a failure with an error message indicating the right size. Wrong driver to open family file will cause a failure, too. Platforms tested: h5committest and fuss. Misc. update: doc/html/RM_H5P.html and doc/html/Tools.html
2005-06-23 02:59:48 +08:00
# convert family file to sec2 file of 20,000 bytes
TOOLTEST -m 20000 -family_to_sec2 family_file%05d.h5 $actual_dir/family_to_sec2.h5
# test the output files repartitioned above.
OUTPUTTEST
echo
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
cd $actual_dir
[svn-r10971] Purpose: Bug fix Description: See details from Bug #213. Family member file size wasn't saved anywhere in file. When family file is opened, the first member size determine the member size. Solution: Hopefully, this is the last step of checkin for this stage. This step mainly enables h5repart tool to be able to convert file driver from family to sec2. Because the library saves family information in file, in trying to convert to sec2 driver, the library simply change the address of driver information to undefined so that the driver information block can be ignored. This step also updates the reference manual of H5Pset_fapl_family() and h5repart. In the fifth step of checkin, backward compatibility with v1.6 is tested. A family file created was created with the v1.6 library and opened with this version of the library. In the fourth step of checkin, a test suit is added for h5repart, including a program to generate the test files, a script file to run h5repart, and a program to verify repartitioned files can be opened by the library. There's a change from the first step of checkin. Family name template is no longer saved in the superblock because different pathname can make the name different. In the third step of checkin, h5repart has been modified. If h5repart is used to change the size of family member file, the new size(actual member size) is saved in the superblock. In the second step of checkin, multi driver is checked against the driver name saved in superblock. Wrong driver will result in a failure with an error message indicating multi driver should be used. This change includes split driver because it's a special case for multi driver. In the first step of checkin. Family member size and name template(unused at this stage) are saved in file superblock. When file is reopened,the size passed in thrin superblock. A different size will trigger a failure with an error message indicating the right size. Wrong driver to open family file will cause a failure, too. Platforms tested: h5committest and fuss. Misc. update: doc/html/RM_H5P.html and doc/html/Tools.html
2005-06-23 02:59:48 +08:00
rm -f fst_family*.h5 scd_family*.h5 family_to_sec2.h5
fi
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