summaryrefslogtreecommitdiffstats
path: root/tools/test/h5format_convert/testh5fc.sh.in
blob: 4ba46cbe88ca3c557c68cdb8dcc394113ee85d68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
#! /bin/sh
#
# Copyright by The HDF Group.
# 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 COPYING file, which can be found at the root of the source code
# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
# Tests for the h5format_convert tool
#
#

srcdir=@srcdir@

# Determine which filters are available
USE_FILTER_SZIP="@USE_FILTER_SZIP@"
USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@"
USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@"
USE_FILTER_NBIT="@USE_FILTER_NBIT@"
USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@"

TESTNAME=h5format_convert
EXIT_SUCCESS=0
EXIT_FAILURE=1

FORMCONV=../../src/h5format_convert/h5format_convert       # The tool name
FORMCONV_BIN=`pwd`/$FORMCONV    # The path of the tool binary

CHK_IDX=h5fc_chk_idx        # The program name
CHK_IDX_BIN=`pwd`/$CHK_IDX        # The program to verify the chunk indexing type is v1 B-tree

RM='rm -rf'
CMP='cmp -s'
DIFF='diff -c'
CP='cp'
H5DUMP=../../src/h5dump/h5dump         # The h5dump tool name
H5DUMP_BIN=`pwd`/$H5DUMP        # The path of the h5dump tool binary
DIRNAME='dirname'
LS='ls'
AWK='awk'

nerrors=0
verbose=yes

# source dirs
SRC_TOOLS="$srcdir/../.."

# testfiles source dirs for tools
SRC_H5LS_TESTFILES="$SRC_TOOLS/test/h5ls/testfiles"
SRC_H5DUMP_TESTFILES="$SRC_TOOLS/test/h5dump/testfiles"
SRC_H5DIFF_TESTFILES="$SRC_TOOLS/test/h5diff/testfiles"
SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
SRC_H5FORMCONV_TESTFILES="$SRC_TOOLS/test/h5format_convert/testfiles"
SRC_H5FORMCONV_OUTFILES="$SRC_TOOLS/test/h5format_convert/expected"

TESTDIR=./testfiles
test -d $TESTDIR || mkdir $TESTDIR

# Copy the testfile to a temporary file for testing as h5format_convert is changing the file in place
TMPOUTFILE=tmp.h5
TMPFILE=tmp.h5
TMPCHKFILE=tmp.h5
TMPDMPFILE=tmp.h5

######################################################################
# test files
# --------------------------------------------------------------------
# All the test files copy from source directory to test directory
# NOTE: Keep this framework to add/remove test files.
#       Any test files from other tools can be used in this framework.
#       This list are also used for checking exist.
#       Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_HDF5_TEST_FILES="
$SRC_H5FORMCONV_TESTFILES/h5fc_non_v3.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_edge_v3.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_ext_none.h5
$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext_none.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_i.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_s.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_f.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_if.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_is.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_sf.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_ext3_isf.h5
$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_i.h5
$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_s.h5
$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_f.h5
$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_if.h5
$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_is.h5
$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_sf.h5
$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext3_isf.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_err_level.h5
"

LIST_ERR_TEST_FILES="
$SRC_H5FORMCONV_OUTFILES/h5fc_d_file.ddl.err
$SRC_H5FORMCONV_OUTFILES/h5fc_dname.err
$SRC_H5FORMCONV_OUTFILES/h5fc_nonexistfile.ddl.err
$SRC_H5FORMCONV_OUTFILES/h5fc_nonexistdset_file.ddl.err
"

LIST_OTHER_TEST_FILES="
$SRC_H5FORMCONV_OUTFILES/h5fc_help.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_nooption.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_d_file.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_dname.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_v_non_chunked.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_v_bt1.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_v_ndata_bt1.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_v_all.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_v_n_1d.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_v_n_all.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_ext1_i.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_ext1_s.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_ext1_f.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_ext2_if.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_ext2_is.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_ext2_sf.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_ext3_isf.ddl
$SRC_H5FORMCONV_OUTFILES/old_h5fc_ext1_i.ddl
$SRC_H5FORMCONV_OUTFILES/old_h5fc_ext1_s.ddl
$SRC_H5FORMCONV_OUTFILES/old_h5fc_ext1_f.ddl
$SRC_H5FORMCONV_OUTFILES/old_h5fc_ext2_if.ddl
$SRC_H5FORMCONV_OUTFILES/old_h5fc_ext2_is.ddl
$SRC_H5FORMCONV_OUTFILES/old_h5fc_ext2_sf.ddl
$SRC_H5FORMCONV_OUTFILES/old_h5fc_ext3_isf.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_v_err.ddl
$SRC_H5FORMCONV_OUTFILES/h5fc_v_err.ddl.err
"

#
# copy test files and expected output files from source dirs to test dir
#
COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_ERR_TEST_FILES $LIST_OTHER_TEST_FILES"

COPY_TESTFILES_TO_TESTDIR()
{
    # copy test files. Used -f to make sure get a new copy
    for tstfile in $COPY_TESTFILES
    do
        # ignore '#' comment
        echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
        RET=$?
        if [ $RET -eq 1 ]; then
            # skip cp if srcdir is same as destdir
            # this occurs when build/test performed in source dir and
            # make cp fail
            SDIR=`$DIRNAME $tstfile`
            INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
            INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
            if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
                $CP -f $tstfile $TESTDIR
                if [ $? -ne 0 ]; then
                    echo "Error: FAILED to copy $tstfile ."

                    # Comment out this to CREATE expected file
                    exit $EXIT_FAILURE
                fi
            fi
        fi
    done
}

CLEAN_TESTFILES_AND_TESTDIR()
{
    # skip rm if srcdir is same as destdir
    # this occurs when build/test performed in source dir and
    # make cp fail
    SDIR=$SRC_H5FORMCONV_TESTFILES
    INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
    INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
    if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
        $RM $TESTDIR
    else
        $RM $TESTDIR/$TMPFILE
        $RM $TESTDIR/$TMPOUTFILE
        $RM $TESTDIR/$TMPCHKFILE
        $RM $TESTDIR/*-$TMPDMPFILE
    fi
}

# Print a line-line message left justified in a field of 80 characters
# beginning with the word "Testing".
#
TESTING() {
   SPACES="                                                               "
   echo "Testing $* $SPACES" | cut -c1-80 | tr -d '\012'
}

# Source in the output filter function definitions.
. $srcdir/../../../bin/output_filter.sh

# Run a test and print PASS or *FAIL*.  If a test fails then increment
# the `nerrors' global variable and (if $verbose is set) display the
# difference between the actual output and the expected output. The
# expected output is given as the first argument to this function and
# the actual output file is calculated by replacing the `.ddl' with
# `.out'.  The actual output is not removed if $HDF5_NOCLEANUP has a
# non-zero value.
#
# $1: expected output
# $2: the test file name
#    --fname might be empty or fname does not exist
#    --fname is copied to a temporary file for testing
# $3 to at most $6--options to the tool such as:
#     -d dname or --dname=dname
#     -v or --verbose
#     -n or --noop
TOOLTEST_OUT() {
    # Prepare expected and actual output
    expect="$TESTDIR/$1"
    expect_err="$TESTDIR/`basename $1 .ddl`.err"
    actual="$TESTDIR/`basename $1 .ddl`.out"
    actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
    actual_sav=${actual}-sav
    actual_err_sav=${actual_err}-sav
    testfile="`basename $1 .ddl`-tmp.h5"

    # Prepare the test file
    $RM $TESTDIR/$testfile
    TFILE=$2
    if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then
    $CP $TESTDIR/$2 $TESTDIR/$testfile
    TFILE=$testfile
    fi

    # Run test.
    TESTING $FORMCONV $3 $4 $5 $6 $2
    (
    cd $TESTDIR
    $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE
    ) >$actual 2>$actual_err
    cp $actual $actual_sav
    cp $actual_err $actual_err_sav

    # Compare output
    COMPARE_OUT $expect $actual

    # Clean up output file
    if test -z "$HDF5_NOCLEANUP"; then
    $RM $actual $actual_err
    $RM $actual $actual_err $actual_sav $actual_err_sav
    fi
}
# Same as TOOLTEST_OUT  but filters error stack output and compares to an error file
TOOLTEST_MASK_OUT() {
    # Prepare expected and actual output
    expect="$TESTDIR/$1"
    expect_err="$TESTDIR/$1.err"
    actual_ext="$TESTDIR/$1.ext"
    actual="$TESTDIR/`basename $1 .ddl`.out"
    actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
    actual_sav=${actual}-sav
    actual_err_sav=${actual_err}-sav
    testfile="`basename $1 .ddl`-tmp.h5"

    # Prepare the test file
    $RM $TESTDIR/$testfile
    TFILE=$2
    if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then
    $CP $TESTDIR/$2 $TESTDIR/$testfile
    TFILE=$testfile
    fi

    # Run test.
    TESTING $FORMCONV $3 $4 $5 $6 $2
    (
    cd $TESTDIR
    $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE
    ) >$actual 2>$actual_err
    cp $actual $actual_sav
    cp $actual_err $actual_err_sav
    STDERR_FILTER $actual_err

    # Extract file name, line number, version and thread IDs because they may be different
    sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
        -e 's/line [0-9]*/line (number)/' \
        -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
        -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
        -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
        -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
     $actual_err > $actual_ext

    # Compare output
    if $CMP $expect $actual; then
      if $CMP $expect_err $actual_ext; then
        echo " PASSED"
      else
        echo "*FAILED*"
        echo "    Expected result (*.err) differs from actual result (*.oerr)"
        nerrors="`expr $nerrors + 1`"
        test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/    /'
      fi
    else
        echo "*FAILED*"
        echo "    Expected result (*.ddl) differs from actual result (*.out)"
        nerrors="`expr $nerrors + 1`"
        test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
    fi

    # Clean up output file
    if test -z "$HDF5_NOCLEANUP"; then
    $RM $actual $actual_err
    $RM $actual $actual_err $actual_sav $actual_err_sav
    fi
}
# Same as TOOLTEST_OUT except only compares error output
TOOLTEST_ERR() {
    # Prepare expected and actual output
    expect="$TESTDIR/$1"
    expect_err="$TESTDIR/$1.err"
    actual="$TESTDIR/`basename $1 .ddl`.out"
    actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
    actual_sav=${actual}-sav
    actual_err_sav=${actual_err}-sav
    testfile="`basename $1 .ddl`-tmp.h5"

    # Prepare the test file
    $RM $TESTDIR/$testfile
    TFILE=$2
    if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then
    $CP $TESTDIR/$2 $TESTDIR/$testfile
    TFILE=$testfile
    fi

    # Run test.
    TESTING $FORMCONV $3 $4 $5 $6 $2
    (
    cd $TESTDIR
    $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE
    ) >$actual 2>$actual_err
    cp $actual $actual_sav
    cp $actual_err $actual_err_sav

    # Compare output
    COMPARE_OUT $expect_err $actual_err

    # Clean up output file
    if test -z "$HDF5_NOCLEANUP"; then
    $RM $actual $actual_err
    $RM $actual $actual_err $actual_sav $actual_err_sav
    fi
}

# To check that the tool exits success, no output
# Assume all short options
# $1 is the test file name
#    --fname exists
#    --fname is copied to a temporary file for testing
# $2 is the temporary file name
# $3 to at most $5--options to the tool such as:
#     -d dname
#     -n
TOOLTEST() {
    TESTING $FORMCONV $3 $4 $5 $1
    testfile="`basename $1 .h5`-tmp.h5"
    $RM $TESTDIR/$testfile
    $CP $TESTDIR/$1 $TESTDIR/$testfile
    $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $TESTDIR/$testfile
    exitcode=$?
    if [ $exitcode -ne 0 ]; then
    echo "*FAILED*"
    echo "    The tool exits failure"
    nerrors="`expr $nerrors + 1`"
    else
    echo " PASSED"
    fi
}

CHECKING() {
   SPACES="                                                               "
   echo "Verifying $* $SPACES" | cut -c1-80 | tr -d '\012'
}

# Assume $TESTDIR/$TMPFILE is the converted test file
# $1 dataset name
IDX_CHECK() {
    CHECKING $1
    $RUNSERIAL $CHK_IDX_BIN $TESTDIR/$2 $1
    ret=$?
    if [ $ret -eq 0 ]; then
    echo " PASSED"
    else
    echo "*FAILED*"
    echo "    The chunk indexing type is not correct"
    nerrors="`expr $nerrors + 1`"
    fi
}

# $1 is the expected output
# $2 is the output from testing
COMPARE_OUT() {
    if $CMP $1 $2; then
        echo " PASSED"
    else
        echo "*FAILED*"
        echo "    Expected result (*.ddl) differs from actual result (*.out)"
        nerrors="`expr $nerrors + 1`"
        test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
    fi
}

# Assume $TESTDIR/$TMPFILE is the converted test file
# $1 is the test file for verifying h5dump output
# $2 is the expected output from h5dump
H5DUMP_CHECK() {
    CHECKING h5dump output for $1
    expect="$TESTDIR/$2"
    actual="$TESTDIR/`basename $2 .ddl`.out"
    actual_err="$TESTDIR/`basename $2 .ddl`.err"
    testfile="`basename $2 .ddl`-tmp.h5"
    $RUNSERIAL $H5DUMP_BIN -BH $TESTDIR/$testfile > $actual 2>$actual_err
    cat $actual_err >> $actual

    # Compare output
    COMPARE_OUT $expect $actual

    # Clean up output file
    if test -z "$HDF5_NOCLEANUP"; then
    $RM $actual $actual_err
    fi
}

# Print a "SKIP" message
SKIP() {
    TESTING $STAT $@
    echo  " -SKIP-"
}



##############################################################################
##############################################################################
###              T H E   T E S T S                                ###
##############################################################################
##############################################################################
# prepare for test
COPY_TESTFILES_TO_TESTDIR
#
#
#
# h5format_convert --help
# h5format_convert (no options)
# h5format_convert nonexist.h5  (no options, file does not exist)
TOOLTEST_OUT h5fc_help.ddl '' --help
TOOLTEST_OUT h5fc_nooption.ddl ''
TOOLTEST_ERR h5fc_nonexistfile.ddl nonexist.h5
#
#
# h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists)
# h5format_convert --dname old_h5fc_ext_none.h5 (just --dname option, file exists)
# h5format_convert --dname (just --dname option)
# h5format_convert --dname=nonexist old_h5fc_ext_none.h5 (dataset does not exist, file exists)
TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 -d
TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 --dname
TOOLTEST_OUT h5fc_dname.ddl '' --dname
TOOLTEST_ERR h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist
#
#
#
# h5format_convert -d /DSET_CONTIGUOUS -v old_h5fc_ext_none.h5 (verbose, contiguous dataset)
# h5format_convert -d /GROUP/DSET_BT2 --verbose old_h5fc_ext_none.h5 (verbose, bt1 dataset)
# h5format_convert -d /DSET_NDATA_BT2 -v -n old_h5fc_ext_none.h5 (verbose, noop, bt1+nodata dataset)
# h5format_convert -v old_h5fc_ext_none.h5 (verbose, all datasets)
TOOLTEST_OUT h5fc_v_non_chunked.ddl old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v
TOOLTEST_OUT h5fc_v_bt1.ddl old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose
TOOLTEST_OUT h5fc_v_ndata_bt1.ddl old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n
TOOLTEST_OUT h5fc_v_all.ddl old_h5fc_ext_none.h5 -v
#
#
#
# h5format_convert -d /DSET_EA -v -n h5fc_ext_none.h5 (verbose, noop, one ea dataset)
# h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets)
TOOLTEST_OUT h5fc_v_n_1d.ddl h5fc_ext_none.h5 -d /DSET_EA -v -n
TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_non_v3.h5 -v -n
#
#
#
# h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset)
TOOLTEST_MASK_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v
#
#
#
# No output from tests
# 1) Use the tool to convert the dataset
# 2) Verify the chunk indexing type is correct
# h5format_convert -d /DSET_EA h5fc_ext_none.h5
# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_ext_none.h5
# h5format_convert -d /GROUP/DSET_BT2 h5fc_ext_none.h5
# h5format_convert -d /DSET_NDATA_BT2 h5fc_ext_none.h5
# h5format_convert -d /DSET_FA h5fc_ext_none.h5
# h5format_convert -d /GROUP/DSET_FA h5fc_ext_none.h5
# h5format_convert -d /DSET_NONE h5fc_ext_none.h5
# h5format_convert -d /GROUP/DSET_NDATA_NONE h5fc_ext_none.h5
TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /DSET_EA
IDX_CHECK /DSET_EA h5fc_ext_none-tmp.h5
#
TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /GROUP/DSET_NDATA_EA
IDX_CHECK /GROUP/DSET_NDATA_EA h5fc_ext_none-tmp.h5
#
TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /GROUP/DSET_BT2
IDX_CHECK /GROUP/DSET_BT2 h5fc_ext_none-tmp.h5
#
TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /DSET_NDATA_BT2
IDX_CHECK /DSET_NDATA_BT2 h5fc_ext_none-tmp.h5
#
TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /DSET_FA
IDX_CHECK /DSET_FA h5fc_ext_none-tmp.h5
#
TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /GROUP/DSET_NDATA_FA
IDX_CHECK /GROUP/DSET_NDATA_FA h5fc_ext_none-tmp.h5
#
TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /DSET_NONE
IDX_CHECK /DSET_NONE h5fc_ext_none-tmp.h5
#
TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /GROUP/DSET_NDATA_NONE
IDX_CHECK /GROUP/DSET_NDATA_NONE h5fc_ext_none-tmp.h5
#
#
#
# No output from tests: just check exit code
# h5format_convert -d /DSET_NDATA_BT2 old_h5fc_ext_none.h5 (v1-btree dataset)
# h5format_convert -d /DSET_CONTIGUOUS h5fc_non_v3.h5 (non-chunked dataset)
TOOLTEST old_h5fc_ext_none.h5 old_h5fc_ext_none-tmp.h5 -d /DSET_NDATA_BT2
TOOLTEST h5fc_non_v3.h5 h5fc_non_v3-tmp.h5 -d /DSET_CONTIGUOUS
#
#
#
# No output from tests: just check exit code
# h5format_convert -d /GROUP/DSET_BT2 -n h5fc_non_v3.h5 (noop, one dataset)
# h5format_convert -n h5fc_non_v3.h5 (noop, all datasets)
TOOLTEST h5fc_non_v3.h5 h5fc_non_v3-tmp.h5 -d /GROUP/DSET_BT2 -n
TOOLTEST h5fc_non_v3.h5 h5fc_non_v3-tmp.h5 -n
#
#
#
# No output from tests: just check exit code
# h5format_convert h5fc_non_v3.h5
# 1) convert all datasets
# 2) verify indexing types
TOOLTEST h5fc_non_v3.h5 h5fc_non_v3-tmp.h5
IDX_CHECK /DSET_NDATA_EA h5fc_non_v3-tmp.h5
IDX_CHECK /DSET_NDATA_BT2 h5fc_non_v3-tmp.h5
IDX_CHECK /GROUP/DSET_BT2 h5fc_non_v3-tmp.h5
IDX_CHECK /GROUP/DSET_EA h5fc_non_v3-tmp.h5
#
#
#
# No output from test: just check exit code
# h5format_convert h5fc_edge_v3.h5
# 1) convert the chunked dataset (filter, no-filter-edge-chunk)
# 2) verify the indexing type
TOOLTEST h5fc_edge_v3.h5 h5fc_edge_v3-tmp.h5
IDX_CHECK /DSET_EDGE h5fc_edge_v3-tmp.h5
#
#

# The following test files have messages in the superblock extension.
# Verify h5dump output for correctness after conversion
TOOLTEST h5fc_ext1_i.h5 h5fc_ext1_i-tmp.h5
H5DUMP_CHECK h5fc_ext1_i.h5 h5fc_ext1_i.ddl
TOOLTEST h5fc_ext1_s.h5 h5fc_ext1_s-tmp.h5
H5DUMP_CHECK h5fc_ext1_s.h5 h5fc_ext1_s.ddl
TOOLTEST h5fc_ext1_f.h5 h5fc_ext1_f-tmp.h5
H5DUMP_CHECK h5fc_ext1_f.h5 h5fc_ext1_f.ddl
#
TOOLTEST h5fc_ext2_if.h5 h5fc_ext2_if-tmp.h5
H5DUMP_CHECK h5fc_ext2_if.h5 h5fc_ext2_if.ddl
TOOLTEST h5fc_ext2_is.h5 h5fc_ext2_is-tmp.h5
H5DUMP_CHECK h5fc_ext2_is.h5 h5fc_ext2_is.ddl
TOOLTEST h5fc_ext2_sf.h5 h5fc_ext2_sf-tmp.h5
H5DUMP_CHECK h5fc_ext2_sf.h5 h5fc_ext2_sf.ddl
#
TOOLTEST h5fc_ext3_isf.h5 h5fc_ext3_isf-tmp.h5
H5DUMP_CHECK h5fc_ext3_isf.h5 h5fc_ext3_isf.ddl
#
#
#
TOOLTEST old_h5fc_ext1_i.h5 old_h5fc_ext1_i-tmp.h5
H5DUMP_CHECK old_h5fc_ext1_i.h5 old_h5fc_ext1_i.ddl
TOOLTEST old_h5fc_ext1_s.h5 old_h5fc_ext1_s-tmp.h5
H5DUMP_CHECK old_h5fc_ext1_s.h5 old_h5fc_ext1_s.ddl
TOOLTEST old_h5fc_ext1_f.h5 old_h5fc_ext1_f-tmp.h5
H5DUMP_CHECK old_h5fc_ext1_f.h5 old_h5fc_ext1_f.ddl
#
TOOLTEST old_h5fc_ext2_if.h5 old_h5fc_ext2_if-tmp.h5
H5DUMP_CHECK old_h5fc_ext2_if.h5 old_h5fc_ext2_if.ddl
TOOLTEST old_h5fc_ext2_is.h5 old_h5fc_ext2_is-tmp.h5
H5DUMP_CHECK old_h5fc_ext2_is.h5 old_h5fc_ext2_is.ddl
TOOLTEST old_h5fc_ext2_sf.h5 old_h5fc_ext2_sf-tmp.h5
H5DUMP_CHECK old_h5fc_ext2_sf.h5 old_h5fc_ext2_sf.ddl
#
TOOLTEST old_h5fc_ext3_isf.h5 old_h5fc_ext3_isf-tmp.h5
H5DUMP_CHECK old_h5fc_ext3_isf.h5 old_h5fc_ext3_isf.ddl
#
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR

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