From b7b4e77f1249fc4872a441c2f0810457b78a790d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 30 Jan 2014 16:27:23 -0500 Subject: [svn-r24666] Fix test folder deletion issue Tested: local linux autotools --- tools/h5repack/h5repack.sh.in | 59 +++++++++++++--------- tools/h5repack/h5repack_plugin.sh.in | 57 ++++++++++++--------- .../testfiles/deflate_limit.h5repack_layout.h5.ddl | 2 +- .../testfiles/h5repack_layout.h5-plugin_test.ddl | 2 +- tools/misc/testh5mkgrp.sh.in | 2 +- 5 files changed, 72 insertions(+), 50 deletions(-) diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index 045aebf..a4d12bd 100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -70,7 +70,7 @@ SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles" SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles" SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles" -TESTDIR=./testfiles +TESTDIR=./testpack test -d $TESTDIR || mkdir $TESTDIR ###################################################################### @@ -209,6 +209,7 @@ DIFFTEST() { VERIFY h5diff output $@ ( + cd $TESTDIR $RUNSERIAL $H5DIFF_BIN -q "$@" ) RET=$? @@ -229,14 +230,15 @@ DIFFTEST() TOOLTEST() { echo $@ - infile=$TESTDIR/$2 - outfile=$TESTDIR/out-$1.$2 + infile=$2 + outfile=out-$1.$2 shift shift # Run test. TESTING $H5REPACK $@ ( + cd $TESTDIR $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile ) RET=$? @@ -254,11 +256,11 @@ TOOLTEST() # Verifying layouts of a dataset VERIFY_LAYOUT_DSET() { - layoutfile=$TESTDIR/layout-$1.$2 + layoutfile=layout-$1.$2 dset=$3 expectlayout=$4 - infile=$TESTDIR/$2 - outfile=$TESTDIR/out-$1.$2 + infile=$2 + outfile=out-$1.$2 shift shift shift @@ -266,6 +268,7 @@ VERIFY_LAYOUT_DSET() TESTING $H5REPACK $@ ( + cd $TESTDIR $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile ) RET=$? @@ -281,9 +284,10 @@ VERIFY_LAYOUT_DSET() # check the layout from a dataset VERIFY "a dataset layout" ( + cd $TESTDIR $RUNSERIAL $H5DUMP_BIN -d $dset -pH $outfile > $layoutfile ) - $GREP $expectlayout $layoutfile > /dev/null + $GREP $expectlayout $TESTDIR/$layoutfile > /dev/null if [ $? -eq 0 ]; then echo " PASSED" else @@ -301,8 +305,8 @@ VERIFY_LAYOUT_DSET() VERIFY_LAYOUT_ALL() { infile=$2 - outfile=$TESTDIR/out-$1.$2 - layoutfile=$TESTDIR/layout-$1.$2 + outfile=out-$1.$2 + layoutfile=layout-$1.$2 expectlayout=$3 shift shift @@ -310,6 +314,7 @@ VERIFY_LAYOUT_ALL() TESTING $H5REPACK $@ ( + cd $TESTDIR $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile ) RET=$? @@ -327,6 +332,7 @@ VERIFY_LAYOUT_ALL() # check if the other layouts still exsit VERIFY "layouts" ( + cd $TESTDIR echo # if CONTIGUOUS if [ $expectlayout = "CONTIGUOUS" ]; then @@ -401,14 +407,15 @@ VERIFY_LAYOUT_ALL() # TOOLTEST0() { - infile=$TESTDIR/$2 - outfile=$TESTDIR/out-$1.$2 + infile=$2 + outfile=out-$1.$2 shift shift # Run test. TESTING $H5REPACK $@ ( + cd $TESTDIR $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile "$@" ) RET=$? @@ -428,14 +435,15 @@ TOOLTEST0() # TOOLTEST1() { - infile=$TESTDIR/$2 - outfile=$TESTDIR/out-$1.$2 + infile=$2 + outfile=out-$1.$2 shift shift # Run test. TESTING $H5REPACK $@ ( + cd $TESTDIR $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile ) RET=$? @@ -458,14 +466,15 @@ TOOLTESTV() actual="$TESTDIR/`basename $2 .ddl`.out" actual_err="$TESTDIR/`basename $2 .ddl`.err" - infile=$TESTDIR/$2 - outfile=$TESTDIR/out-$1.$2 + infile=$2 + outfile=out-$1.$2 shift shift # Run test. TESTING $H5REPACK $@ ( + cd $TESTDIR $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile ) >$actual 2>$actual_err RET=$? @@ -500,8 +509,8 @@ TOOLTESTV() # TOOLTEST_DUMP() { - infile=$TESTDIR/$2 - outfile=$TESTDIR/out-$1.$2 + infile=$2 + outfile=out-$1.$2 expect="$TESTDIR/$1.$2.ddl" actual="$TESTDIR/out-$1.$2.out" actual_err="$TESTDIR/out-$1.$2.err" @@ -512,6 +521,7 @@ TOOLTEST_DUMP() # Run test. TESTING $H5REPACK $@ ( + cd $TESTDIR $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile ) >$actual 2>$actual_err RET=$? @@ -522,6 +532,7 @@ TOOLTEST_DUMP() echo " PASSED" VERIFY h5dump output $@ ( + cd $TESTDIR $RUNSERIAL $H5DUMP_BIN -pH $outfile ) >$actual 2>$actual_err cat $actual_err >> $actual @@ -559,14 +570,15 @@ TOOLTEST_DUMP() # Verify the output file of second run is larger than the one of 1st run. TOOLTEST_META() { - infile=$TESTDIR/$2 - outfile=$TESTDIR/out-$1.$2 + infile=$2 + outfile=out-$1.$2 shift shift # Run test. TESTING $H5REPACK $@ ( + cd $TESTDIR $RUNSERIAL $H5REPACK_BIN $infile $outfile ) RET=$? @@ -578,12 +590,13 @@ TOOLTEST_META() DIFFTEST $infile $outfile fi # get the size of the first output file - size1=`wc -c $outfile | cut -d' ' -f1` + size1=`wc -c $TESTDIR/$outfile | cut -d' ' -f1` # 2nd run with metadata option # Run test. TESTING $H5REPACK $@ ( + cd $TESTDIR $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile ) RET=$? @@ -595,7 +608,7 @@ TOOLTEST_META() DIFFTEST $infile $outfile fi # get the size of the second output file - size2=`wc -c $outfile | cut -d' ' -f1` + size2=`wc -c $TESTDIR/$outfile | cut -d' ' -f1` # verify sizes. MESSAGE "Verify the sizes of both output files ($size1 vs $size2)" @@ -927,7 +940,7 @@ else fi #file -arg="h5repack_layout.h5 -e $TESTDIR/h5repack.info" +arg="h5repack_layout.h5 -e h5repack.info" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else @@ -1064,7 +1077,7 @@ else fi # add a userblock to file -arg="h5repack_objs.h5 -u $TESTDIR/ublock.bin -b 2048" +arg="h5repack_objs.h5 -u ublock.bin -b 2048" TOOLTEST add_userblock $arg # add alignment diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in index df4b374..7502397 100644 --- a/tools/h5repack/h5repack_plugin.sh.in +++ b/tools/h5repack/h5repack_plugin.sh.in @@ -49,7 +49,7 @@ SRC_TOOLS="$srcdir/.." # testfiles source dirs for tools SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles" -TESTDIR=testfiles +TESTDIR=testplug test -d $TESTDIR || mkdir $TESTDIR ###################################################################### @@ -66,6 +66,10 @@ $SRC_H5REPACK_TESTFILES/h5repack_layout.h5 $SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl $SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst " +#$SRC_H5REPACK_TESTFILES/h5repack_layout.UD.h5 +#$SRC_H5REPACK_TESTFILES/h5repack_layout.UD.h5-plugin_none.ddl +#$SRC_H5REPACK_TESTFILES/plugin_none.h5repack_layout.UD.h5.tst +#" # # copy test files and expected output files from source dirs to test dir @@ -88,7 +92,7 @@ if [ $? != 0 ]; then fi # setup plugin path -ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_LIBDIR}" +ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}" COPY_TESTFILES_TO_TESTDIR() { @@ -171,8 +175,8 @@ STDOUT_FILTER() { TOOLTEST_DUMP() { echo $@ - infile=$TESTDIR/$2 - outfile=$TESTDIR/out-$1.$2 + infile=$2 + outfile=out-$1.$2 expect1="$TESTDIR/$1.$2.tst" actual1="$TESTDIR/$1.$2.out" actual1_err="$TESTDIR/$1.$2.err" @@ -186,35 +190,37 @@ TOOLTEST_DUMP() # Run test. TESTING $H5REPACK $@ ( - $ENVCMD $H5REPACK_BIN "$@" $infile $outfile + cd $TESTDIR + $ENVCMD $H5REPACK_BIN "$@" $infile $outfile ) >$actual1 2>$actual1_err RET=$? STDOUT_FILTER $actual1 cat $actual1_err >> $actual1 if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - if cmp -s $expect1 $actual1; then - echo " PASSED" - else echo "*FAILED*" - echo " Expected result (*.tst) differs from actual result (*.out)" nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && diff -c $expect1 $actual1 |sed 's/^/ /' - fi - VERIFY h5dump output -pH $outfile - ( + else + echo " PASSED" + if cmp -s $expect1 $actual1; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.tst) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && diff -c $expect1 $actual1 |sed 's/^/ /' + fi + VERIFY h5dump output -pH $outfile + ( + cd $TESTDIR $ENVCMD $H5DUMP_BIN -pH $outfile - ) >$actual2 2>$actual2_err - RET=$? - cat $actual2_err >> $actual2 + ) >$actual2 2>$actual2_err + RET=$? + cat $actual2_err >> $actual2 - if cmp -s $expect2 $actual2; then - echo " PASSED" - else - echo "*FAILED*" + if cmp -s $expect2 $actual2; then + echo " PASSED" + else + echo "*FAILED*" echo " Expected result (*.ddl) differs from actual result (*.out)" nerrors="`expr $nerrors + 1`" test yes = "$verbose" && diff -c $expect2 $actual2 |sed 's/^/ /' @@ -237,6 +243,9 @@ COPY_TESTFILES_TO_TESTDIR arg="h5repack_layout.h5 -v -f UD=257,1,9" TOOLTEST_DUMP plugin_test $arg +#arg="h5repack_layout.UD.h5 -v -f NONE" +#TOOLTEST_DUMP plugin_none $arg + # print results if test $nerrors -ne 0 ; then echo "$nerrors errors encountered" diff --git a/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl index d380201..b8e7e68 100644 --- a/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl +++ b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/out-deflate_limit.h5repack_layout.h5" { +HDF5 "out-deflate_limit.h5repack_layout.h5" { GROUP "/" { DATASET "dset1" { DATATYPE H5T_STD_I32LE diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl index a7ba967..7a3a01e 100644 --- a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl +++ b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl @@ -1,4 +1,4 @@ -HDF5 "testfiles/out-plugin_test.h5repack_layout.h5" { +HDF5 "out-plugin_test.h5repack_layout.h5" { GROUP "/" { DATASET "dset1" { DATATYPE H5T_STD_I32LE diff --git a/tools/misc/testh5mkgrp.sh.in b/tools/misc/testh5mkgrp.sh.in index 85205a8..190e824 100644 --- a/tools/misc/testh5mkgrp.sh.in +++ b/tools/misc/testh5mkgrp.sh.in @@ -49,7 +49,7 @@ SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" # testfiles source dirs for tools SRC_H5MKGRP_TESTFILES="$SRC_TOOLS/misc/testfiles" -TESTDIR=./testfiles +TESTDIR=./testgrp test -d $TESTDIR || mkdir -p $TESTDIR ###################################################################### -- cgit v0.12