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 h5dump tool with packed bits type files
15
16srcdir=@srcdir@
17
18# Determine which filters are available
19USE_FILTER_SZIP="@USE_FILTER_SZIP@"
20USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
21
22TESTNAME=h5dump
23EXIT_SUCCESS=0
24EXIT_FAILURE=1
25
26DUMPER=../../src/h5dump/h5dump                     # The tool name
27DUMPER_BIN=`pwd`/$DUMPER          # The path of the tool binary
28
29H5DIFF=../../src/h5diff/h5diff           # The h5diff tool name
30H5DIFF_BIN=`pwd`/$H5DIFF          # The path of the h5diff  tool binary
31
32H5IMPORT=../../src/h5import/h5import     # The h5import tool name
33H5IMPORT_BIN=`pwd`/$H5IMPORT      # The path of the h5import  tool binary
34
35RM='rm -rf'
36CMP='cmp -s'
37DIFF='diff -c'
38CP='cp'
39DIRNAME='dirname'
40LS='ls'
41AWK='awk'
42
43nerrors=0
44verbose=yes
45
46# source dirs
47SRC_TOOLS="$srcdir/../.."
48
49SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles"
50# testfiles source dirs for tools
51SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES"
52SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES"
53SRC_H5DUMP_ERRORFILES="$srcdir/errfiles"
54SRC_H5DIFF_TESTFILES="$SRC_TOOLS/test/h5diff/testfiles"
55SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
56SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
57SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
58SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
59SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
60
61TEST_P_DIR=./testfiles
62TESTDIR=./testfiles/pbits
63test -d $TEST_P_DIR || mkdir -p $TEST_P_DIR
64test -d $TESTDIR || mkdir -p $TESTDIR
65
66######################################################################
67# test files
68# --------------------------------------------------------------------
69# All the test files copy from source directory to test directory
70# NOTE: Keep this framework to add/remove test files.
71#       Any test files from other tools can be used in this framework.
72#       This list are also used for checking exist.
73#       Comment '#' without space can be used.
74# --------------------------------------------------------------------
75LIST_HDF5_TEST_FILES="
76$SRC_H5DUMP_TESTFILES/packedbits.h5
77$SRC_H5DUMP_TESTFILES/tarray1.h5
78$SRC_H5DUMP_TESTFILES/tcompound.h5
79"
80
81LIST_OTHER_TEST_FILES="
82$SRC_H5DUMP_TESTFILES/pbits/tnofilename-with-packed-bits.ddl
83$SRC_H5DUMP_TESTFILES/pbits/tpbitsArray.ddl
84$SRC_H5DUMP_TESTFILES/pbits/tpbitsCompound.ddl
85$SRC_H5DUMP_TESTFILES/pbits/tpbitsIncomplete.ddl
86$SRC_H5DUMP_TESTFILES/pbits/tpbitsLengthExceeded.ddl
87$SRC_H5DUMP_TESTFILES/pbits/tpbitsCharLengthExceeded.ddl
88$SRC_H5DUMP_TESTFILES/pbits/tpbitsIntLengthExceeded.ddl
89$SRC_H5DUMP_TESTFILES/pbits/tpbitsLongLengthExceeded.ddl
90$SRC_H5DUMP_TESTFILES/pbits/tpbitsLengthPositive.ddl
91$SRC_H5DUMP_TESTFILES/pbits/tpbitsMax.ddl
92$SRC_H5DUMP_TESTFILES/pbits/tpbitsMaxExceeded.ddl
93$SRC_H5DUMP_TESTFILES/pbits/tpbitsOffsetExceeded.ddl
94$SRC_H5DUMP_TESTFILES/pbits/tpbitsCharOffsetExceeded.ddl
95$SRC_H5DUMP_TESTFILES/pbits/tpbitsIntOffsetExceeded.ddl
96$SRC_H5DUMP_TESTFILES/pbits/tpbitsLongOffsetExceeded.ddl
97$SRC_H5DUMP_TESTFILES/pbits/tpbitsOffsetNegative.ddl
98$SRC_H5DUMP_TESTFILES/pbits/tpbitsOverlapped.ddl
99$SRC_H5DUMP_TESTFILES/pbits/tpbitsSigned.ddl
100$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsigned.ddl
101$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedInt.ddl
102$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedInt.ddl
103$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLong.ddl
104$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLong.ddl
105$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLong.ddl
106$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLong.ddl
107$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedWhole.ddl
108$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedWhole.ddl
109$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedIntWhole.ddl
110$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedIntWhole.ddl
111$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongWhole.ddl
112$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongWhole.ddl
113$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLongWhole.ddl
114$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLongWhole.ddl
115$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLongWhole1.ddl
116$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLongWhole1.ddl
117$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLongWhole63.ddl
118$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLongWhole63.ddl
119$SRC_H5DUMP_TESTFILES/pbits/tpbitsSigned4.ddl
120$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsigned4.ddl
121$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedInt8.ddl
122$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedInt8.ddl
123$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLong16.ddl
124$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLong16.ddl
125$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLong32.ddl
126$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLong32.ddl
127$SRC_H5DUMP_TESTFILES/pbits/tpbitsSigned2.ddl
128$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsigned2.ddl
129$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedInt4.ddl
130$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedInt4.ddl
131$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLong8.ddl
132$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLong8.ddl
133$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLong16.ddl
134$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLong16.ddl
135"
136
137LIST_ERROR_TEST_FILES="
138${SRC_H5DUMP_ERRORFILES}/tnofilename-with-packed-bits.err
139${SRC_H5DUMP_ERRORFILES}/tpbitsCharLengthExceeded.err
140${SRC_H5DUMP_ERRORFILES}/tpbitsCharOffsetExceeded.err
141${SRC_H5DUMP_ERRORFILES}/tpbitsIncomplete.err
142${SRC_H5DUMP_ERRORFILES}/tpbitsIntLengthExceeded.err
143${SRC_H5DUMP_ERRORFILES}/tpbitsIntOffsetExceeded.err
144${SRC_H5DUMP_ERRORFILES}/tpbitsLengthExceeded.err
145${SRC_H5DUMP_ERRORFILES}/tpbitsLengthPositive.err
146${SRC_H5DUMP_ERRORFILES}/tpbitsLongLengthExceeded.err
147${SRC_H5DUMP_ERRORFILES}/tpbitsLongOffsetExceeded.err
148${SRC_H5DUMP_ERRORFILES}/tpbitsMaxExceeded.err
149${SRC_H5DUMP_ERRORFILES}/tpbitsOffsetExceeded.err
150${SRC_H5DUMP_ERRORFILES}/tpbitsOffsetNegative.err
151"
152
153#
154# copy test files and expected output files from source dirs to test dir
155#
156COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_ERROR_TEST_FILES"
157
158COPY_TESTFILES_TO_TESTDIR()
159{
160    # copy test files. Used -f to make sure get a new copy
161    for tstfile in $COPY_TESTFILES
162    do
163        # ignore '#' comment
164        echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
165        RET=$?
166        if [ $RET -eq 1 ]; then
167            # skip cp if srcdir is same as destdir
168            # this occurs when build/test performed in source dir and
169            # make cp fail
170            SDIR=`$DIRNAME $tstfile`
171            INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
172            INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
173            if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
174              $CP -f $tstfile $TESTDIR
175                if [ $? -ne 0 ]; then
176                    echo "Error: FAILED to copy $tstfile ."
177
178                    # Comment out this to CREATE expected file
179                    exit $EXIT_FAILURE
180                fi
181            fi
182        fi
183    done
184}
185
186CLEAN_TESTFILES_AND_TESTDIR()
187{
188    # skip rm if srcdir is same as destdir
189    # this occurs when build/test performed in source dir and
190    # make cp fail
191    SDIR=$SRC_H5DUMP_TESTFILES/pbits
192    INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
193    INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
194    if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
195        $RM $TESTDIR
196    fi
197}
198
199# Print a line-line message left justified in a field of 70 characters
200# beginning with the word "Testing".
201#
202TESTING() {
203   SPACES="                                                               "
204   echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
205}
206
207# Source in the output filter function definitions.
208. $srcdir/../../../bin/output_filter.sh
209
210# Run a test and print PASS or *FAIL*.  If a test fails then increment
211# the `nerrors' global variable and (if $verbose is set) display the
212# difference between the actual output and the expected output. The
213# expected output is given as the first argument to this function and
214# the actual output file is calculated by replacing the `.ddl' with
215# `.out'.  The actual output is not removed if $HDF5_NOCLEANUP has a
216# non-zero value.
217#
218TOOLTEST() {
219    expect="$TESTDIR/$1"
220    actual="$TESTDIR/`basename $1 .ddl`.out"
221    actual_err="$TESTDIR/`basename $1 .ddl`.err"
222    actual_sav=${actual}-sav
223    actual_err_sav=${actual_err}-sav
224    shift
225
226    # Run test.
227    TESTING $DUMPER $@
228    (
229    cd $TESTDIR
230      $RUNSERIAL $DUMPER_BIN "$@"
231    ) >$actual 2>$actual_err
232
233    # save actual and actual_err in case they are needed later.
234    cp $actual $actual_sav
235    STDOUT_FILTER $actual
236    cp $actual_err $actual_err_sav
237    STDERR_FILTER $actual_err
238
239  if [ ! -f $expect ]; then
240    # Create the expect file if it doesn't yet exist.
241     echo " CREATED"
242     cp $actual $expect
243     echo "    Expected result (*.ddl) missing"
244     nerrors="`expr $nerrors + 1`"
245    elif $CMP $expect $actual; then
246     echo " PASSED"
247    else
248     echo "*FAILED*"
249     echo "    Expected result (*.ddl) differs from actual result (*.out)"
250   nerrors="`expr $nerrors + 1`"
251   test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
252    fi
253
254    # Clean up output file
255    if test -z "$HDF5_NOCLEANUP"; then
256   rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
257    fi
258
259}
260
261
262# same as TOOLTEST1 but compares generated file to expected output
263#                   and compares the generated data file to the expected data file
264# used for the binary tests that expect a full path in -o without -b
265TOOLTEST2() {
266
267    expectdata="$TESTDIR/$1"
268    expect="$TESTDIR/`basename $1 .exp`.ddl"
269    actualdata="$TESTDIR/`basename $1 .exp`.txt"
270    actual="$TESTDIR/`basename $1 .exp`.out"
271    actual_err="$TESTDIR/`basename $1 .exp`.err"
272    shift
273
274    # Run test.
275    TESTING $DUMPER $@
276    (
277      cd $TESTDIR
278      $RUNSERIAL $DUMPER_BIN "$@"
279    ) >$actual 2>$actual_err
280
281    if [ ! -f $expect ]; then
282    # Create the expect file if it doesn't yet exist.
283     echo " CREATED"
284     cp $actual $expect
285     echo "    Expected result (*.ddl) missing"
286     nerrors="`expr $nerrors + 1`"
287    elif $CMP $expect $actual; then
288      if [ ! -f $expectdata ]; then
289      # Create the expect data file if it doesn't yet exist.
290        echo " CREATED"
291        cp $actualdata $expectdata
292        echo "    Expected data (*.exp) missing"
293        nerrors="`expr $nerrors + 1`"
294      elif $CMP $expectdata $actualdata; then
295        echo " PASSED"
296      else
297        echo "*FAILED*"
298        echo "    Expected datafile (*.exp) differs from actual datafile (*.txt)"
299        nerrors="`expr $nerrors + 1`"
300        test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/    /'
301      fi
302    else
303     echo "*FAILED*"
304     echo "    Expected result (*.ddl) differs from actual result (*.out)"
305     nerrors="`expr $nerrors + 1`"
306     test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
307    fi
308
309    # Clean up output file
310    if test -z "$HDF5_NOCLEANUP"; then
311     rm -f $actual $actualdata $actual_err
312    fi
313
314}
315
316# same as TOOLTEST but filters error stack outp
317# Extract file name, line number, version and thread IDs because they may be different
318TOOLTEST3() {
319
320    expect="$TESTDIR/$1"
321    actual="$TESTDIR/`basename $1 .ddl`.out"
322    actual_err="$TESTDIR/`basename $1 .ddl`.err"
323    actual_ext="$TESTDIR/`basename $1 .ddl`.ext"
324    actual_sav=${actual}-sav
325    actual_err_sav=${actual_err}-sav
326    shift
327
328    # Run test.
329    TESTING $DUMPER $@
330    (
331      cd $TESTDIR
332      $RUNSERIAL $DUMPER_BIN "$@"
333    ) >$actual 2>$actual_err
334
335    # save actual and actual_err in case they are needed later.
336    cp $actual $actual_sav
337    STDOUT_FILTER $actual
338    cp $actual_err $actual_err_sav
339    STDERR_FILTER $actual_err
340
341    # Extract file name, line number, version and thread IDs because they may be different
342    sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
343        -e 's/line [0-9]*/line (number)/' \
344        -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
345        -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
346        -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
347        -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
348     $actual_err > $actual_ext
349
350    if [ ! -f $expect ]; then
351    # Create the expect file if it doesn't yet exist.
352     echo " CREATED"
353     cp $actual $expect
354     echo "    Expected result (*.ddl) missing"
355     nerrors="`expr $nerrors + 1`"
356    elif $CMP $expect $actual; then
357     echo " PASSED"
358    else
359     echo "*FAILED*"
360     echo "    Expected result (*.ddl) differs from actual result (*.out)"
361     nerrors="`expr $nerrors + 1`"
362     test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
363    fi
364
365    # Clean up output file
366    if test -z "$HDF5_NOCLEANUP"; then
367   rm -f $actual $actual_err $actual_sav $actual_err_sav
368    fi
369
370}
371
372# same as TOOLTEST3 but filters error stack output and compares to an error file
373# Extract file name, line number, version and thread IDs because they may be different
374TOOLTEST4() {
375
376    expect="$TESTDIR/$1"
377    expect_err="$TESTDIR/`basename $1 .ddl`.err"
378    actual="$TESTDIR/`basename $1 .ddl`.out"
379    actual_err="$TESTDIR/`basename $1 .ddl`.oerr"
380    actual_ext="$TESTDIR/`basename $1 .ddl`.ext"
381    actual_sav=${actual}-sav
382    actual_err_sav=${actual_err}-sav
383    shift
384
385    # Run test.
386    TESTING $DUMPER $@
387    (
388      cd $TESTDIR
389      $RUNSERIAL $DUMPER_BIN "$@"
390    ) >$actual 2>$actual_err
391
392    # save actual and actual_err in case they are needed later.
393    cp $actual $actual_sav
394    STDOUT_FILTER $actual
395    cp $actual_err $actual_err_sav
396    STDERR_FILTER $actual_err
397
398    # Extract file name, line number, version and thread IDs because they may be different
399    sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
400        -e 's/line [0-9]*/line (number)/' \
401        -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
402        -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
403        -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
404        -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
405     $actual_err > $actual_ext
406
407    if [ ! -f $expect ]; then
408    # Create the expect file if it doesn't yet exist.
409     echo " CREATED"
410     cp $actual $expect
411     echo "    Expected result (*.ddl) missing"
412     nerrors="`expr $nerrors + 1`"
413    elif $CMP $expect $actual; then
414     if $CMP $expect_err $actual_ext; then
415      echo " PASSED"
416     else
417      echo "*FAILED*"
418      echo "    Expected result (*.err) differs from actual result (*.oerr)"
419      nerrors="`expr $nerrors + 1`"
420      test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/    /'
421     fi
422    else
423     echo "*FAILED*"
424     echo "    Expected result (*.ddl) differs from actual result (*.out)"
425     nerrors="`expr $nerrors + 1`"
426     test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
427    fi
428
429    # Clean up output file
430    if test -z "$HDF5_NOCLEANUP"; then
431   rm -f $actual $actual_err $actual_sav $actual_err_sav
432    fi
433
434}
435
436# Print a "SKIP" message
437SKIP() {
438   TESTING $DUMPER $@
439    echo  " -SKIP-"
440}
441
442# Print a line-line message left justified in a field of 70 characters
443#
444PRINT_H5DIFF() {
445 SPACES="                                                               "
446 echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012'
447}
448
449
450# Call the h5diff tool
451#
452DIFFTEST()
453{
454    PRINT_H5DIFF  $@
455    (
456  cd $TESTDIR
457  $RUNSERIAL $H5DIFF_BIN "$@" -q
458    )
459    RET=$?
460    if [ $RET != 0 ] ; then
461         echo "*FAILED*"
462         nerrors="`expr $nerrors + 1`"
463    else
464         echo " PASSED"
465    fi
466
467}
468
469# Print a line-line message left justified in a field of 70 characters
470# beginning with the word "Verifying".
471#
472PRINT_H5IMPORT() {
473 SPACES="                                                               "
474 echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012'
475}
476
477# Call the h5import tool
478#
479IMPORTTEST()
480{
481    # remove the output hdf5 file if it exists
482    hdf5_file="$TESTDIR/$5"
483    if [ -f $hdf5_file ]; then
484     rm -f $hdf5_file
485    fi
486
487    PRINT_H5IMPORT  $@
488    (
489  cd $TESTDIR
490  $RUNSERIAL $H5IMPORT_BIN "$@"
491    )
492    RET=$?
493    if [ $RET != 0 ] ; then
494         echo "*FAILED*"
495         nerrors="`expr $nerrors + 1`"
496    else
497         echo " PASSED"
498    fi
499
500}
501
502
503##############################################################################
504##############################################################################
505###        T H E   T E S T S                                            ###
506##############################################################################
507##############################################################################
508# prepare for test
509COPY_TESTFILES_TO_TESTDIR
510
511####### test for dataset packed bits ######
512
513# test failure handling
514# Missing file name
515TOOLTEST tnofilename-with-packed-bits.ddl --enable-error-stack
516# Limits:
517# Maximum number of packed bits is 8 (for now).
518# Maximum integer size is 64 (for now).
519# Maximun Offset is 63 (Maximum size - 1).
520# Maximum Offset+Length is 64 (Maximum size).
521# Tests:
522# Normal operation on both signed and unsigned int datasets.
523# Sanity check
524# Their rawdata output should be the same.
525TOOLTEST tpbitsSignedWhole.ddl --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5
526TOOLTEST tpbitsUnsignedWhole.ddl --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5
527TOOLTEST tpbitsSignedIntWhole.ddl --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5
528TOOLTEST tpbitsUnsignedIntWhole.ddl --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5
529TOOLTEST tpbitsSignedLongWhole.ddl --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5
530TOOLTEST tpbitsUnsignedLongWhole.ddl --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5
531TOOLTEST tpbitsSignedLongLongWhole.ddl --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5
532TOOLTEST tpbitsUnsignedLongLongWhole.ddl --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5
533TOOLTEST tpbitsSignedLongLongWhole63.ddl --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5
534TOOLTEST tpbitsUnsignedLongLongWhole63.ddl --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5
535TOOLTEST tpbitsSignedLongLongWhole1.ddl --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5
536TOOLTEST tpbitsUnsignedLongLongWhole1.ddl --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5
537# Half sections
538TOOLTEST tpbitsSigned4.ddl --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5
539TOOLTEST tpbitsUnsigned4.ddl --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5
540TOOLTEST tpbitsSignedInt8.ddl --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5
541TOOLTEST tpbitsUnsignedInt8.ddl --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5
542TOOLTEST tpbitsSignedLong16.ddl --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5
543TOOLTEST tpbitsUnsignedLong16.ddl --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5
544TOOLTEST tpbitsSignedLongLong32.ddl --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5
545TOOLTEST tpbitsUnsignedLongLong32.ddl --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5
546# Quarter sections
547TOOLTEST tpbitsSigned2.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5
548TOOLTEST tpbitsUnsigned2.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5
549TOOLTEST tpbitsSignedInt4.ddl --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5
550TOOLTEST tpbitsUnsignedInt4.ddl --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5
551TOOLTEST tpbitsSignedLong8.ddl --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5
552TOOLTEST tpbitsUnsignedLong8.ddl --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5
553TOOLTEST tpbitsSignedLongLong16.ddl --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5
554TOOLTEST tpbitsUnsignedLongLong16.ddl --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5
555# Begin and End
556TOOLTEST tpbitsSigned.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5
557TOOLTEST tpbitsUnsigned.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5
558TOOLTEST tpbitsSignedInt.ddl --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5
559TOOLTEST tpbitsUnsignedInt.ddl --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5
560TOOLTEST tpbitsSignedLong.ddl --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5
561TOOLTEST tpbitsUnsignedLong.ddl --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5
562TOOLTEST tpbitsSignedLongLong.ddl --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5
563TOOLTEST tpbitsUnsignedLongLong.ddl --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5
564# Overlapped packed bits.
565TOOLTEST tpbitsOverlapped.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5
566# Maximum number of packed bits.
567TOOLTEST tpbitsMax.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5
568# Compound type.
569TOOLTEST tpbitsCompound.ddl --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5
570# Array type.
571TOOLTEST tpbitsArray.ddl --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5
572# Test Error handling.
573# Too many packed bits requested. Max is 8 for now.
574TOOLTEST tpbitsMaxExceeded.ddl --enable-error-stack -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5
575# Offset too large. Max is 7 (8-1) for now.
576TOOLTEST tpbitsOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5
577TOOLTEST tpbitsCharOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5
578TOOLTEST tpbitsIntOffsetExceeded.ddl --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5
579TOOLTEST tpbitsLongOffsetExceeded.ddl --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5
580# Bad offset, must not be negative.
581TOOLTEST tpbitsOffsetNegative.ddl --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5
582# Bad length, must not be positive.
583TOOLTEST tpbitsLengthPositive.ddl --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5
584# Offset+Length is too large. Max is 8 for now.
585TOOLTEST tpbitsLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5
586TOOLTEST tpbitsCharLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5
587TOOLTEST tpbitsIntLengthExceeded.ddl --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5
588TOOLTEST tpbitsLongLengthExceeded.ddl --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5
589# Incomplete pair of packed bits request.
590TOOLTEST tpbitsIncomplete.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5
591
592# Clean up temporary files/directories
593CLEAN_TESTFILES_AND_TESTDIR
594
595# Report test results and exit
596if test $nerrors -eq 0 ; then
597    echo "All $TESTNAME tests passed."
598    exit $EXIT_SUCCESS
599else
600    echo "$TESTNAME tests failed with $nerrors errors."
601    exit $EXIT_FAILURE
602fi
603