1#! /bin/sh
2#
3# Copyright by The HDF Group.
4# Copyright by the Board of Trustees of the University of Illinois.
5# All rights reserved.
6#
7# This file is part of HDF5.  The full HDF5 copyright notice, including
8# terms governing use, modification, and redistribution, is contained in
9# the COPYING file, which can be found at the root of the source code
10# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
11# If you do not have access to either file, you may request a copy from
12# help@hdfgroup.org.
13#
14# Tests for the h5jam/h5unjam tools
15
16srcdir=@srcdir@
17
18# Determine which filters are available
19USE_FILTER_SZIP="@USE_FILTER_SZIP@"
20USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
21
22TESTNAME=../../src/h5jam/h5unjam
23EXIT_SUCCESS=0
24EXIT_FAILURE=1
25
26DUMPER=../../src/h5dump/h5dump               # The dumper to use
27DUMPER_BIN=`pwd`/../$DUMPER    # The path of the dumper binary
28JAM=../../src/h5jam/h5jam                     # Tool to test
29UNJAM=../../src/h5jam/h5unjam                     # Tool to test
30JAM_BIN="$RUNSERIAL "`pwd`    # The path of the jam binary
31UNJAM_BIN=`pwd`    # The path of the jam binary
32
33RM='rm -rf'
34CMP='cmp -s'
35DIFF='diff -c'
36AWK='awk'
37CP='cp'
38DIRNAME='dirname'
39LS='ls'
40AWK='awk'
41
42nerrors=0
43verbose=yes
44
45# source dirs
46SRC_TOOLS="$srcdir/../.."
47SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles"
48
49# testfiles source dirs for tools
50SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES"
51SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES"
52SRC_H5DIFF_TESTFILES="$SRC_TOOLS/test/h5diff/testfiles"
53SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
54SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
55SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
56SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
57SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
58
59TESTDIR=./testfiles
60test -d $TESTDIR || mkdir $TESTDIR
61
62######################################################################
63# test files
64# --------------------------------------------------------------------
65# All the test files copy from source directory to test directory
66# NOTE: Keep this framework to add/remove test files.
67#       Any test files from other tools can be used in this framework.
68#       This list are also used for checking exist.
69#       Comment '#' without space can be used.
70# --------------------------------------------------------------------
71LIST_HDF5_TEST_FILES="
72$SRC_H5JAM_TESTFILES/tall.h5
73$SRC_H5JAM_TESTFILES/twithub.h5
74$SRC_H5JAM_TESTFILES/twithub513.h5
75"
76LIST_OTHER_TEST_FILES="
77$SRC_H5JAM_TESTFILES/u10.txt
78$SRC_H5JAM_TESTFILES/u511.txt
79$SRC_H5JAM_TESTFILES/u512.txt
80$SRC_H5JAM_TESTFILES/u513.txt
81$SRC_H5JAM_TESTFILES/h5jam-help.txt
82$SRC_H5JAM_TESTFILES/h5unjam-help.txt
83$SRC_H5JAM_TESTFILES/h5jam-ub-nohdf5.txt
84"
85
86# Source in the output filter function definitions.
87. $srcdir/../../../bin/output_filter.sh
88
89#
90# copy test files and expected output files from source dirs to test dir
91#
92COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
93
94COPY_TESTFILES_TO_TESTDIR()
95{
96    # copy test files. Used -f to make sure get a new copy
97    for tstfile in $COPY_TESTFILES
98    do
99        # ignore '#' comment
100        echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
101        RET=$?
102        if [ $RET -eq 1 ]; then
103            # skip cp if srcdir is same as destdir
104            # this occurs when build/test performed in source dir and
105            # make cp fail
106            SDIR=`$DIRNAME $tstfile`
107            INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
108            INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
109            if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
110                $CP -f $tstfile $TESTDIR
111                if [ $? -ne 0 ]; then
112                    echo "Error: FAILED to copy $tstfile ."
113
114                    # Comment out this to CREATE expected file
115                    exit $EXIT_FAILURE
116                fi
117            fi
118        fi
119    done
120}
121
122CLEAN_TESTFILES_AND_TESTDIR()
123{
124    # skip rm if srcdir is same as destdir
125    # this occurs when build/test performed in source dir and
126    # make cp fail
127    SDIR=$SRC_H5JAM_TESTFILES
128    INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
129    INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
130    if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
131        $RM $TESTDIR
132    fi
133}
134
135# Print a line-line message left justified in a field of 70 characters
136# beginning with the word "Testing".
137#
138TESTING() {
139   SPACES="                                                               "
140   echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
141}
142
143# Print a line-line message left justified in a field of 70 characters
144# beginning with the word "Compare".
145#
146COMPARE() {
147   SPACES="                                                               "
148   echo "Compare $* $SPACES" | cut -c1-70 | tr -d '\012'
149}
150
151# Print a "SKIP" message
152SKIP() {
153 TESTING $JAM $@
154 echo  " -SKIP-"
155}
156
157#
158#  COMPARE_FILES a.h5 b.h5
159#    Compare two files, skipping the first line.  This is used to
160#    compare the output of the dumper, skipping the file name which
161#    is different.
162#    The result is stored in 'compval'.
163#
164cmpval=0;
165COMPARE_FILES() {
166    $AWK 'NR > 1' $1 > $1.cmp
167    $AWK 'NR > 1' $2 > $2.cmp
168    $CMP $1.cmp $2.cmp
169    cmpval=$?
170        rm -f $1.cmp $2.cmp
171}
172
173#  CLEANUP files
174#     Clean up named files.
175CLEANUP() {
176   if test -z "$HDF5_NOCLEANUP"; then
177    for i in $*
178    do
179        rm -f $i
180    done
181   fi
182}
183
184#  SETUP file tocopy
185#    Clone a standard input file in the test directory
186#  Modification:
187#    Was using "cp" command which means file $2 will inherit the permission
188#    setting of file $1.  If $1 is read-only, so will $2.  That will cause
189#    failure when the test attempts to write it later on.  Changed to use
190#    the "cat" command.
191#
192SETUP() {
193    cat < $1 > $2
194}
195
196#
197#  CHECKFILE orig.h5 compar.h5
198#     Check that the test file is the same as an original.
199#     The two files are dumped with the dumper, and the output
200#     compared with COMPARE_FILES.
201#     If the files are the same, the test reports " PASSED",
202#     otherwise, it reports "*FAILED*"
203CHECKFILE() {
204   expected="`dirname $2`/`basename $2 .h5`.out"
205   expected_err="`dirname $2`/`basename $2 .h5`.err"
206   actual="`basename $1 .h5`.out"
207   actual_err="`basename $1 .h5`.err"
208
209   $RUNSERIAL $DUMPER_BIN/$DUMPER $1 >$expected 2>$expected_err
210   cat $expected_err >> $expected
211
212   # dump the test file
213   COMPARE $2 to $1
214   $RUNSERIAL $DUMPER_BIN/$DUMPER $2 >$actual 2>$actual_err
215   cat $actual_err >> $actual
216
217   # compare the two files (ignore line 1)
218   COMPARE_FILES $actual $expected
219   if [ "$cmpval" = 0 ] ; then
220      echo " PASSED"
221   else
222      echo "*FAILED*"
223      echo "    Expected result (*.ddl) differs from actual result (*.out)"
224      nerrors="`expr $nerrors + 1`"
225      test yes = "$verbose" && $DIFF $expected $actual |sed 's/^/    /'
226   fi
227
228   # Clean up output files
229   if test -z "$HDF5_NOCLEANUP"; then
230      rm -f $actual $actual_err
231      rm -f $expected $expected_err
232   fi
233}
234
235#
236# CHECK_UB file.h5 user_block_file origfile.h5
237#
238#   Check the user block in 'file.h5' is the same as
239#   'user_block' (allowing for padding).
240#
241#   If the original file had a user block before the test
242#   then 'compare.h5' is passed.  The user block must be extracted
243#   and the test file compared to:
244#      cat compare_ub user_block_file.
245#
246#   This test uses './getub' to extract the user block from
247#   'file.h5', which is compared to the file described above.
248#
249#   The result is set in variable 'result1'.
250#
251result1=0;
252CHECK_UB_1() {
253    hfile="$1"
254    ufile="$2"
255
256    # check for third argument (the original file)
257    origfile="";
258    if [ -n "$3" ];
259    then
260        origfile="$3"
261    fi
262
263    # find the length of the user block to check
264    s1=`cat $ufile | wc -c | sed -e 's/ //g'`
265    if [ "$s1" = "0" ];
266    then
267        echo "File "$ufile" is empty"
268        result1=1;
269    fi
270
271    # Get the size of the original user block, if any.
272    if [ -n "$origfile" ];
273    then
274        # 'tellub' calls H5Fget_user_block to get the size
275        #  of the user block
276        s2=`$JAM_BIN/tellub $origfile`
277        if [ "$s2" = "0" ];
278        then
279            size=$s1;
280            cmpfile=$ufile
281        else
282            cmpfile="tt2"
283            size=`expr $s2 + $s1`
284            $JAM_BIN/getub -c $s2 $origfile > $cmpfile
285            cat $ufile >> $cmpfile
286        fi
287    else
288        # assume no user block
289        s2="0"
290        size=$s1;
291        cmpfile=$ufile
292    fi
293
294    # Extract 'size' bytes from the front of 'hfile'
295    # Compare to 'cmpfile', result is set in result1
296    tfile="tt1"
297    $JAM_BIN/getub -c $size $hfile > $tfile
298    res=`cmp $cmpfile $tfile`
299    if [ "$?" != "0" ];
300    then
301        echo $res
302        result1=1;
303    else
304        result1=0;
305    fi
306
307    # clean up
308    rm -f  $tfile
309    if [ "$s2" != "0" ] ;
310    then
311        rm -f $cmpfile
312    fi
313}
314
315
316#  CHECK_NOUB file.h5
317#
318#  Check that 'file.h5' has no user block.
319#  Setst result2 to 1 if there is a user block (fail), 0 if none (pass)
320
321result2=0;
322
323CHECK_NOUB() {
324    hfile="$1"
325
326    # call 'ubsize' to get the size of the user block
327    ubsize=`$JAM_BIN/tellub $hfile`
328
329    if [ "$?" != "0" ];
330    then
331        # error
332        result2=1;
333    else
334    if [ "$ubsize" = "0" ];
335    then
336        # pass
337        result2=0;
338    else
339        # fail
340        result2=1;
341    fi
342    fi
343}
344
345#  JAMTEST user_block file.h5 [--clobber] [ofile.h5]
346#
347#    Test the 'jam' tool:
348#      1. figure out the input and output, and the comparision
349#         that will be done.
350#      2. call 'jam' with the appropriate arguments
351#      3. check the user block is correct in the output (Check_UB)
352#    If the user block is correct, print "PASSED", else "*FAILED*"
353JAMTEST() {
354    ufile="$1"
355    ifile="$2"
356    compare_test=""   # the file to test
357    compare_orig=""   # the comparison to test against
358    cleanup=""
359
360    # sort out the arguments for the test and the check
361    do_clobber="no"
362    if [ "$3" = "--clobber" ];
363    then
364        #  clobber overwrites any existing user block
365        do_clobber="yes"
366        clobber="--clobber"
367        compare_orig=""
368        if [ -z "$4" ];
369        then
370            # output goes to infile, compare ubfile to infile
371            ofile=""
372            compare_test="$ifile"
373        else
374            # output goes to $4,  compare ofile to ubfile
375            ofile="$4"
376            compare_test="$ofile"
377        fi
378    else
379        clobber=""
380        # add user block to existing ub, if any
381        if [ -z "$3" ];
382        then
383            # output goes to infile, compare ubfile to infile
384            ofile=""
385            compare_test="$ifile"
386            cp $ifile xxofile.h5
387            compare_orig="xxofile.h5"
388            cleanup="$cleanup $compare_orig"
389        else
390            # output goes to $3,  compare ofile to ubfile
391            ofile="$3"
392            compare_test="$ofile"
393            compare_orig="$ifile"
394        fi
395    fi
396
397    # call 'jam' with the appropriate arguments
398    if [ -n "$ofile" ];
399    then
400        TESTING h5jam -u `basename $ufile` -i `basename $ifile` -o `basename $ofile` $clobber
401        $JAM_BIN/$JAM -u $ufile -i $ifile -o $ofile $clobber
402    else
403        TESTING jam -u `basename $ufile` -i `basename $ifile` $clobber
404        $JAM_BIN/$JAM -u $ufile -i $ifile $clobber
405    fi
406
407    #echo "CHECK_UB_1 $compare_test $ufile $compare_orig"
408    CHECK_UB_1 $compare_test $ufile $compare_orig
409
410    if [ "$result1" = "0" ] ;
411    then
412        echo " PASSED"
413    else
414        echo " *FAILED*"
415            nerrors="`expr $nerrors + 1`"
416    fi
417    CLEANUP $cleanup
418}
419
420# UNJAMTEST  file.h5 [- | --delete] ofile
421#
422#  Test the 'unjam' tool
423#
424###fix the working directory here and in jamtest
425UNJAMTEST () {
426    infile="$1"
427    ofile="$3"
428    if [ "$2" = "-" ];
429    then
430        uofile="uofile"
431        TESTING h5unjam -i `basename $infile` -o `basename $ofile` "> "`basename $uofile`
432        $JAM_BIN/$UNJAM -i $infile -o $ofile > $uofile
433    else
434    if [ "$2" = "--delete" ];
435    then
436        uofile="none"
437        TESTING h5unjam -i `basename $infile` -o `basename $ofile` --delete
438        $JAM_BIN/$UNJAM  -i $infile -o $ofile --delete
439
440    else
441        uofile="$2"
442        TESTING h5unjam -i `basename $infile` -u `basename $uofile` -o `basename $ofile`
443        $JAM_BIN/$UNJAM  -i $infile -u $uofile -o $ofile
444    fi
445    fi
446
447    result1=0
448    result2=0
449    cleanup=""
450    if [ "$uofile" != "none" ];
451    then
452        # sets result1
453        CHECK_UB_1 $infile $uofile
454        CLEANUP $uofile
455    fi
456
457    # sets result2
458    CHECK_NOUB $ofile
459
460    if [ "$result1" = "0" -a "$result2" = "0" ];
461    then
462        echo " PASSED"
463    else
464        echo " *FAILED*"
465        nerrors="`expr $nerrors + 1`"
466    fi
467}
468
469
470#
471# TOOLTEST_OUTPUT < JAM | UNJAM > expect-output.txt exit-code options
472#
473# Only verify stdout/stderr output from h5jam and j5unjam
474#
475
476TOOLTEST_OUTPUT() {
477    if [ "$1" == "JAM" ]; then
478        TOOLCMD=$JAM_BIN/$JAM
479    elif [ "$1" == "UNJAM" ]; then
480        TOOLCMD=$JAM_BIN/$UNJAM
481    fi
482    shift
483    expect="$TESTDIR/$1"
484    actual="$TESTDIR/`basename $1 .ls`.out"
485    actual_err="$TESTDIR/`basename $1 .ls`.err"
486    actual_sav=${actual}-sav
487    actual_err_sav=${actual_err}-sav
488    shift
489    retvalexpect=$1
490    shift
491
492    TESTING h5jam $@
493    (
494        cd $TESTDIR
495        $TOOLCMD "$@"
496    ) >$actual 2>$actual_err
497
498    # save actual and actual_err in case they are needed later.
499    cp $actual $actual_sav
500    STDOUT_FILTER $actual
501    cp $actual_err $actual_err_sav
502    STDERR_FILTER $actual_err
503    # combine stderr to stdout for output compare
504    cat $actual_err >> $actual
505
506    if [ ! -f $expect ]; then
507        # Create the expect file if it doesn't yet exist.
508        echo " CREATED"
509        cp $actual $expect
510        echo "    Expected result (*.ls) missing"
511        nerrors="`expr $nerrors + 1`"
512        rm -f $actual $actual_sav $actual_err $actual_err_sav
513    elif $CMP $expect $actual; then
514        echo " PASSED"
515        rm -f $actual $actual_sav $actual_err $actual_err_sav
516    else
517        echo "*FAILED*"
518        echo "    Expected result differs from actual result"
519        nerrors="`expr $nerrors + 1`"
520        test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
521    fi
522}
523
524##############################################################################
525##############################################################################
526###              T H E   T E S T S                                ###
527##############################################################################
528##############################################################################
529# prepare for test
530COPY_TESTFILES_TO_TESTDIR
531
532#-------------------------------
533# Testing h5jam
534#-------------------------------
535# help page
536TOOLTEST_OUTPUT JAM h5jam-help.txt 0 -h
537
538# don't allow HDF5 format file as an user block file
539TOOLTEST_OUTPUT JAM h5jam-ub-nohdf5.txt 1 -i tall.h5 -u tall.h5 -o tall-tmp.h5
540
541JAMTEST $TESTDIR/u10.txt $TESTDIR/tall.h5 ta2.h5
542CHECKFILE $TESTDIR/tall.h5 ta2.h5
543CLEANUP ta2.h5
544JAMTEST $TESTDIR/u511.txt $TESTDIR/tall.h5 ta3.h5
545CHECKFILE $TESTDIR/tall.h5 ta3.h5
546CLEANUP ta3.h5
547JAMTEST $TESTDIR/u512.txt $TESTDIR/tall.h5 ta4.h5
548CHECKFILE $TESTDIR/tall.h5 ta4.h5
549CLEANUP ta4.h5
550JAMTEST $TESTDIR/u513.txt $TESTDIR/tall.h5 ta5.h5
551CHECKFILE $TESTDIR/tall.h5 ta5.h5
552CLEANUP ta5.h5
553
554SETUP $TESTDIR/tall.h5 ta6.h5
555JAMTEST $TESTDIR/u10.txt ta6.h5
556CHECKFILE $TESTDIR/tall.h5 ta6.h5
557CLEANUP ta6.h5
558SETUP $TESTDIR/tall.h5 ta7.h5
559JAMTEST $TESTDIR/u511.txt ta7.h5
560CHECKFILE $TESTDIR/tall.h5 ta7.h5
561CLEANUP ta7.h5
562SETUP $TESTDIR/tall.h5 ta8.h5
563JAMTEST $TESTDIR/u512.txt ta8.h5
564CHECKFILE $TESTDIR/tall.h5 ta8.h5
565CLEANUP ta8.h5
566SETUP $TESTDIR/tall.h5 ta9.h5
567JAMTEST $TESTDIR/u513.txt ta9.h5
568CHECKFILE $TESTDIR/tall.h5 ta9.h5
569CLEANUP ta9.h5
570
571JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 tax2.h5
572CHECKFILE $TESTDIR/tall.h5 tax2.h5
573CLEANUP tax2.h5
574JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub.h5 tax3.h5
575CHECKFILE $TESTDIR/tall.h5 tax3.h5
576CLEANUP tax3.h5
577JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub.h5 tax4.h5
578CHECKFILE $TESTDIR/tall.h5 tax4.h5
579CLEANUP tax4.h5
580JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub.h5 tax5.h5
581CHECKFILE $TESTDIR/tall.h5 tax5.h5
582CLEANUP tax5.h5
583
584JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub513.h5 tax6.h5
585CHECKFILE $TESTDIR/tall.h5 tax6.h5
586CLEANUP tax6.h5
587JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub513.h5 tax7.h5
588CHECKFILE $TESTDIR/tall.h5 tax7.h5
589CLEANUP tax7.h5
590JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub513.h5 tax8.h5
591CHECKFILE $TESTDIR/tall.h5 tax8.h5
592CLEANUP tax8.h5
593JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 tax9.h5
594CHECKFILE $TESTDIR/tall.h5 tax9.h5
595CLEANUP tax9.h5
596
597JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 --clobber taz2.h5
598CHECKFILE $TESTDIR/tall.h5 taz2.h5
599CLEANUP taz2.h5
600JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub.h5 --clobber taz3.h5
601CHECKFILE $TESTDIR/tall.h5 taz3.h5
602CLEANUP taz3.h5
603JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub.h5 --clobber taz4.h5
604CHECKFILE $TESTDIR/tall.h5 taz4.h5
605CLEANUP taz4.h5
606JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub.h5 --clobber taz5.h5
607CHECKFILE $TESTDIR/tall.h5 taz5.h5
608CLEANUP taz5.h5
609
610JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub513.h5 --clobber taz6.h5
611CHECKFILE $TESTDIR/tall.h5 taz6.h5
612CLEANUP taz6.h5
613JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub513.h5 --clobber taz7.h5
614CHECKFILE $TESTDIR/tall.h5 taz7.h5
615CLEANUP taz7.h5
616JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub513.h5 --clobber taz8.h5
617CHECKFILE $TESTDIR/tall.h5 taz8.h5
618CLEANUP taz8.h5
619JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 --clobber taz9.h5
620CHECKFILE $TESTDIR/tall.h5 taz9.h5
621CLEANUP taz9.h5
622
623SETUP $TESTDIR/twithub.h5 tay2.h5
624JAMTEST $TESTDIR/u10.txt tay2.h5 --clobber
625CHECKFILE $TESTDIR/tall.h5 tay2.h5
626CLEANUP tay2.h5
627SETUP $TESTDIR/twithub.h5 tay3.h5
628JAMTEST $TESTDIR/u511.txt tay3.h5 --clobber
629CHECKFILE $TESTDIR/tall.h5 tay3.h5
630CLEANUP tay3.h5
631SETUP $TESTDIR/twithub.h5 tay4.h5
632JAMTEST $TESTDIR/u512.txt tay4.h5 --clobber
633CHECKFILE $TESTDIR/tall.h5 tay4.h5
634CLEANUP tay4.h5
635SETUP $TESTDIR/twithub.h5 tay5.h5
636JAMTEST $TESTDIR/u513.txt tay5.h5 --clobber
637CHECKFILE $TESTDIR/tall.h5 tay5.h5
638CLEANUP tay5.h5
639
640SETUP $TESTDIR/twithub513.h5 tay6.h5
641JAMTEST $TESTDIR/u10.txt tay6.h5 --clobber
642CHECKFILE $TESTDIR/tall.h5 tay6.h5
643CLEANUP tay6.h5
644SETUP $TESTDIR/twithub513.h5 tay7.h5
645JAMTEST $TESTDIR/u511.txt tay7.h5 --clobber
646CHECKFILE $TESTDIR/tall.h5 tay7.h5
647CLEANUP tay7.h5
648SETUP $TESTDIR/twithub513.h5 tay8.h5
649JAMTEST $TESTDIR/u512.txt tay8.h5 --clobber
650CHECKFILE $TESTDIR/tall.h5 tay8.h5
651CLEANUP tay8.h5
652SETUP $TESTDIR/twithub513.h5 tay9.h5
653JAMTEST $TESTDIR/u513.txt tay9.h5 --clobber
654CHECKFILE $TESTDIR/tall.h5 tay9.h5
655CLEANUP tay9.h5
656
657#---------------------------------
658# Testing h5unjam
659#---------------------------------
660# help page
661TOOLTEST_OUTPUT UNJAM h5unjam-help.txt 0 -h
662
663SETUP $TESTDIR/twithub.h5 tai1.h5
664UNJAMTEST tai1.h5 o10.txt taa1.h5
665CHECKFILE $TESTDIR/tall.h5 taa1.h5
666CLEANUP taa1.h5 tai1.h5 o10.txt
667SETUP $TESTDIR/twithub513.h5 tai2.h5
668UNJAMTEST tai2.h5 o512.txt taa2.h5
669CHECKFILE $TESTDIR/tall.h5 taa2.h5
670CLEANUP taa2.h5 tai2.h5 o512.txt
671
672SETUP $TESTDIR/twithub.h5 tai3.h5
673UNJAMTEST tai3.h5 - taa3.h5
674CHECKFILE $TESTDIR/tall.h5 taa3.h5
675CLEANUP taa3.h5 tai3.h5
676SETUP $TESTDIR/twithub513.h5 tai4.h5
677UNJAMTEST tai4.h5 - taa4.h5
678CHECKFILE $TESTDIR/tall.h5 taa4.h5
679CLEANUP taa4.h5 tai4.h5
680
681SETUP $TESTDIR/twithub.h5 taj2.h5
682UNJAMTEST taj2.h5 --delete tac2.h5
683CHECKFILE $TESTDIR/tall.h5 tac2.h5
684CLEANUP tac2.h5 taj2.h5
685SETUP $TESTDIR/twithub513.h5 taj3.h5
686UNJAMTEST taj3.h5 --delete tac3.h5
687CHECKFILE $TESTDIR/tall.h5 tac3.h5
688CLEANUP tac3.h5 taj3.h5
689
690# Clean up temporary files/directories
691CLEAN_TESTFILES_AND_TESTDIR
692
693if test $nerrors -eq 0 ; then
694    echo "All $TESTNAME tests passed."
695    exit $EXIT_SUCCESS
696else
697    echo "$TESTNAME tests failed with $nerrors errors."
698    exit $EXIT_FAILURE
699fi
700