Modifications based on review comments from pull request.

Made changes according to review comments and discussion with Allen.
This commit is contained in:
Vailin Choi 2017-04-19 22:51:39 -05:00
parent 22d54edf90
commit ddd8cf0e1c
4 changed files with 110 additions and 99 deletions

View File

@ -1478,6 +1478,7 @@
./tools/test/misc/testfiles/h5clear_sec2_v3.h5
./tools/test/misc/testfiles/latest_h5clear_log_v3.h5
./tools/test/misc/testfiles/latest_h5clear_sec2_v3.h5
./tools/test/misc/testfiles/mod_h5clear_mdc_image.h5
./tools/test/misc/testfiles/h5mkgrp_help.txt
./tools/test/misc/testfiles/h5mkgrp_version.txt.in
./tools/test/misc/h5perf_gentest.c

Binary file not shown.

View File

@ -73,6 +73,7 @@ $SRC_H5CLEAR_TESTFILES/h5clear_log_v3.h5
$SRC_H5CLEAR_TESTFILES/latest_h5clear_log_v3.h5
$SRC_H5CLEAR_TESTFILES/latest_h5clear_sec2_v3.h5
$SRC_H5CLEAR_TESTFILES/h5clear_mdc_image.h5
$SRC_H5CLEAR_TESTFILES/mod_h5clear_mdc_image.h5
"
COPY_TESTFILES_TO_TESTDIR()
@ -123,7 +124,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
#
TESTING() {
SPACES=" "
echo "Testing $* $SPACES" | cut -c1-74 | tr -d '\012'
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}
# $1 is the expected output
@ -162,6 +163,7 @@ TOOLTEST_OUT() {
# Run test.
TESTING $H5CLEAR $option1 $option2 $fname
(
cd $TESTDIR
$RUNSERIAL $H5CLEAR_BIN $option1 $option2 $fname
) >$actual 2>$actual_err
cp $actual $actual_sav
@ -182,7 +184,10 @@ TOOLTEST_OUT() {
OPEN_CHK() {
fname=$1
expected=$2
(
cd $TESTDIR
$OPENCHK_BIN $fname 2>/dev/null
)
actual=$?
if test $actual -ne $expected; then
echo "Unexpected return from $OPENCHK"
@ -202,9 +207,11 @@ TOOLTEST() {
ret_expected=$4
#
TESTING $H5CLEAR $option1 $option2 $fname
fname=$1
# h5clear $option1 $option2 $fname
(
cd $TESTDIR
$RUNSERIAL $H5CLEAR_BIN $option1 $option2 $fname 2>/dev/null 1>/dev/null
)
if test $? -ne $ret_expected; then
echo "*FAILED*"
nerrors=`expr $nerrors + 1`
@ -220,6 +227,10 @@ TOOLTEST() {
##############################################################################
# prepare for testing
COPY_TESTFILES_TO_TESTDIR
# For Cmake
$CP -f $TESTDIR/h5clear_sec2_v0.h5 $TESTDIR/orig_h5clear_sec2_v0.h5
$CP -f $TESTDIR/h5clear_sec2_v2.h5 $TESTDIR/orig_h5clear_sec2_v2.h5
$CP -f $TESTDIR/h5clear_sec2_v3.h5 $TESTDIR/orig_h5clear_sec2_v3.h5
#
#
#
@ -227,85 +238,84 @@ COPY_TESTFILES_TO_TESTDIR
# "h5clear -h"
# "h5clear" (no options, no file)
# "h5clear junk.h5" (no options, nonexisting file)
# "h5clear h5clear_sec2_v3.h5" (no options, existing file)
# "h5clear orig_h5clear_sec2_v3.h5" (no options, existing file)
# "h5clear -m" (valid 1 option, no file)
# "h5clear -s junk.h5" (valid 1 option, nonexisting file)
# "h5clear -m -s" (valid 2 options, no file)
# "h5clear -m -s junk.h5" (valid 2 options, nonexisting file)
# "h5clear -m h5clear_sec2_v2.h5" (valid 1 option, existing file, no cache image)
# "h5clear -s -m h5clear_sec2_v0.h5" (valid 2 options, existing file, no cache image)
# "h5clear -m orig_h5clear_sec2_v2.h5" (valid 1 option, existing file, no cache image)
# "h5clear -s -m orig_h5clear_sec2_v0.h5" (valid 2 options, existing file, no cache image)
TOOLTEST_OUT "" -h "" h5clear_usage.ddl
TOOLTEST_OUT "" "" "" h5clear_usage.ddl
TOOLTEST_OUT junk.h5 "" "" h5clear_usage.ddl
TOOLTEST_OUT $TESTDIR/h5clear_sec2_v3.h5 "" "" h5clear_usage.ddl
TOOLTEST_OUT orig_h5clear_sec2_v3.h5 "" "" h5clear_usage.ddl
TOOLTEST_OUT "" -m "" h5clear_missing_file.ddl
TOOLTEST_OUT junk.h5 -s "" h5clear_open_fail.ddl
TOOLTEST_OUT "" -m -s h5clear_missing_file.ddl
TOOLTEST_OUT junk.h5 -m -s h5clear_open_fail.ddl
TOOLTEST_OUT $TESTDIR/h5clear_sec2_v2.h5 -m "" h5clear_no_mdc_image.ddl
TOOLTEST_OUT $TESTDIR/h5clear_sec2_v0.h5 -s -m h5clear_no_mdc_image.ddl
TOOLTEST_OUT orig_h5clear_sec2_v2.h5 -m "" h5clear_no_mdc_image.ddl
TOOLTEST_OUT orig_h5clear_sec2_v0.h5 -s -m h5clear_no_mdc_image.ddl
#
#
#
# The following are tests to verify the expected exit code from h5clear:
# "h5clear -m h5clear_mdc_image.h5" (valid option, existing file, succeed exit code)
# "h5clear --vers" (valid option, version #, succeed exit code)
# "h5clear -k" (invalid 1 option, no file, fail exit code)
# "h5clear -k junk.h5" (invalid 1 option, nonexisting file, fail exit code)
# "h5clear -l h5clear_sec2_v2.h5" (invalid 1 option, existing file, fail exit code)
# "h5clear -m -k" (valid/invalid 2 options, nofile, fail exit code)
# "h5clear -l -m" (invalid/valid 2 options, nofile, fail exit code)
# "h5clear -m -k junk.h5" (valid/invalid 2 options, nonexisting file, fail exit code)
# "h5clear -m -l junk.h5" (valid/invalid 2 options, nonexisting file, fail exit code)
# "h5clear -l -m junk.h5" (invalid/valid 2 options, nonexisting file, fail exit code)
# "h5clear -m -k h5clear_sec2_v0.h5" (valid/invalid 2 options, existing file, fail exit code)
# "h5clear -m -l h5clear_sec2_v0.h5" (valid/invalid 2 options, existing file, fail exit code)
# "h5clear -l -m h5clear_sec2_v0.h5" (invalid/valid 2 options, existing file, fail exit code)
TOOLTEST h5clear_mdc_image.h5 -m "" $SUCCEED
TOOLTEST "" --vers "" $SUCCEED
TOOLTEST "" -k "" $FAIL
TOOLTEST junk.h5 -k "" $FAIL
TOOLTEST h5clear_sec2_v2.h5 -l "" $FAIL
TOOLTEST "" -m -k $FAIL
TOOLTEST "" -l -m $FAIL
TOOLTEST junk.h5 -m -k $FAIL
TOOLTEST junk.h5 -m -l $FAIL
TOOLTEST junk.h5 -l -m $FAIL
TOOLTEST $TESTDIR/h5clear_sec2_v0.h5 -m -k $FAIL
TOOLTEST $TESTDIR/h5clear_sec2_v0.h5 -l -m $FAIL
#
# "h5clear --vers" (valid option, version #, succeed exit code)
# "h5clear -m h5clear_mdc_image.h5" (valid option, existing file, succeed exit code)
TOOLTEST "" --vers "" $SUCCEED
TOOLTEST $TESTDIR/h5clear_mdc_image.h5 -m "" $SUCCEED
TOOLTEST h5clear_sec2_v0.h5 -m -l $FAIL
TOOLTEST h5clear_sec2_v0.h5 -l -m $FAIL
#
#
#
# h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear:
TOOLTEST_OUT $TESTDIR/h5clear_mdc_image.h5 -m "" h5clear_no_mdc_image.ddl
TOOLTEST_OUT $TESTDIR/h5clear_mdc_image.h5 -s -m h5clear_no_mdc_image.ddl
TOOLTEST_OUT mod_h5clear_mdc_image.h5 -m "" h5clear_no_mdc_image.ddl
TOOLTEST_OUT mod_h5clear_mdc_image.h5 -s -m h5clear_no_mdc_image.ddl
#
#
#
# The following are tests to verify the status_flags field is cleared properly:
OPEN_CHK $TESTDIR/h5clear_sec2_v3.h5 $FAIL
TOOLTEST $TESTDIR/h5clear_sec2_v3.h5 -s "" $SUCCEED
OPEN_CHK $TESTDIR/h5clear_sec2_v3.h5 $SUCCEED
OPEN_CHK h5clear_sec2_v3.h5 $FAIL
TOOLTEST h5clear_sec2_v3.h5 -s "" $SUCCEED
OPEN_CHK h5clear_sec2_v3.h5 $SUCCEED
#
OPEN_CHK $TESTDIR/h5clear_log_v3.h5 $FAIL
TOOLTEST $TESTDIR/h5clear_log_v3.h5 -s "" $SUCCEED
OPEN_CHK $TESTDIR/h5clear_log_v3.h5 $SUCCEED
OPEN_CHK h5clear_log_v3.h5 $FAIL
TOOLTEST h5clear_log_v3.h5 -s "" $SUCCEED
OPEN_CHK h5clear_log_v3.h5 $SUCCEED
#
OPEN_CHK $TESTDIR/latest_h5clear_sec2_v3.h5 $FAIL
TOOLTEST $TESTDIR/latest_h5clear_sec2_v3.h5 -s "" $SUCCEED
OPEN_CHK $TESTDIR/latest_h5clear_sec2_v3.h5 $SUCCEED
OPEN_CHK latest_h5clear_sec2_v3.h5 $FAIL
TOOLTEST latest_h5clear_sec2_v3.h5 -s "" $SUCCEED
OPEN_CHK latest_h5clear_sec2_v3.h5 $SUCCEED
#
OPEN_CHK $TESTDIR/latest_h5clear_log_v3.h5 $FAIL
TOOLTEST $TESTDIR/latest_h5clear_log_v3.h5 -s "" $SUCCEED
OPEN_CHK $TESTDIR/latest_h5clear_log_v3.h5 $SUCCEED
OPEN_CHK latest_h5clear_log_v3.h5 $FAIL
TOOLTEST latest_h5clear_log_v3.h5 -s "" $SUCCEED
OPEN_CHK latest_h5clear_log_v3.h5 $SUCCEED
#
# File open succeeds for the following 2 test files because the
# library does not check status_flags for files with < v3 superblock:
OPEN_CHK $TESTDIR/h5clear_sec2_v0.h5 $SUCCEED
TOOLTEST $TESTDIR/h5clear_sec2_v0.h5 -s "" $SUCCEED
OPEN_CHK $TESTDIR/h5clear_sec2_v0.h5 $SUCCEED
OPEN_CHK h5clear_sec2_v0.h5 $SUCCEED
TOOLTEST h5clear_sec2_v0.h5 -s "" $SUCCEED
OPEN_CHK h5clear_sec2_v0.h5 $SUCCEED
#
OPEN_CHK $TESTDIR/h5clear_sec2_v2.h5 $SUCCEED
TOOLTEST $TESTDIR/h5clear_sec2_v2.h5 -s "" $SUCCEED
OPEN_CHK $TESTDIR/h5clear_sec2_v2.h5 $SUCCEED
OPEN_CHK h5clear_sec2_v2.h5 $SUCCEED
TOOLTEST h5clear_sec2_v2.h5 -s "" $SUCCEED
OPEN_CHK h5clear_sec2_v2.h5 $SUCCEED
#
#
#