2007-02-08 12:14:26 +08:00
|
|
|
$!#
|
|
|
|
$!# Copyright by The HDF Group.
|
|
|
|
$!# Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
$!# 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 files COPYING and Copyright.html. COPYING can be found at the root
|
|
|
|
$!# of the source code distribution tree; Copyright.html can be found at the
|
|
|
|
$!# root level of an installed copy of the electronic HDF5 document set and
|
|
|
|
$!# is linked from the top-level documents page. It can also be found at
|
|
|
|
$!# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
|
|
|
$!# access to either file, you may request a copy from help@hdfgroup.org.
|
|
|
|
$!#
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
|
|
|
$ ! This command file tests h5import utility. The command file has to
|
|
|
|
$ ! run in the [hdf5-top.tools.h5import.testfiles] directory.
|
|
|
|
$ !
|
|
|
|
$ !
|
2008-01-10 06:27:55 +08:00
|
|
|
$ type sys$input
|
|
|
|
|
|
|
|
===================================
|
|
|
|
Testing h5import utiltity
|
|
|
|
===================================
|
|
|
|
|
2006-08-03 03:08:09 +08:00
|
|
|
$ ! Define symbols
|
|
|
|
$ !
|
|
|
|
$ current_dir = F$DIRECTRY()
|
|
|
|
$ len = F$LENGTH(current_dir)
|
|
|
|
$ temp = F$EXTRACT(0, len-19, current_dir)
|
|
|
|
$ h5dump_dir = temp + "H5DUMP]"
|
|
|
|
$ h5dump :== $sys$disk:'h5dump_dir'h5dump.exe
|
|
|
|
$ h5import_dir = temp + "H5IMPORT]"
|
|
|
|
$ h5import :== $sys$disk:'h5import_dir'h5import.exe
|
|
|
|
$ h5importtest :== $sys$disk:'h5import_dir'h5importtest.exe
|
|
|
|
$ !
|
|
|
|
$ ! Define output for diff command that compares expected and actual
|
|
|
|
$ ! outputs of h5dump
|
|
|
|
$ !
|
2008-01-04 05:18:14 +08:00
|
|
|
$ create h5import.log
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
|
|
|
$ ! h5import tests
|
|
|
|
$ !
|
|
|
|
$ ! Run h5importtest to create input files
|
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ run [.-]h5importtest
|
2008-01-04 05:18:14 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing ASCII I32 rank 3 - Output BE
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "txtin32. -c textin32. -o" test1.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing ASCII I16 rank 3 - Output LE - CHUNKED - extended
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "txtin16. -c textin16. -o" test2.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing ASCII I8 - rank 3 - Output I16 LE-Chunked+Extended+Compressed
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "txtin16. -c textin8. -o" test3.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing ASCII UI32 - rank 3 - Output BE
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "in1. -c textuin32. -o" test4.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing ASCII UI16 - rank 2 - Output LE+Chunked+Compressed
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "in1. -c textuin16. -o" test5.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing ASCII F32 - rank 3 - Output LE
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "fp1. -c textfp32. -o" test6.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "fp2. -c textfp64. -o" test7.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "bfp64. -c conbfp64. -o" test8.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing BINARY I16 - rank 3 - Output order LE + CHUNKED + extended
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "bin16. -c conbin16. -o" test9.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "bin8. -c conbin8. -o" test10.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing BINARY I32 - rank 3 - Output BE + CHUNKED
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "bin32. -c conbin32. -o" test11.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing BINARY UI16 - rank 3 - Output byte BE + CHUNKED
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "buin16. -c conbuin16. -o" test12.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
2008-01-04 05:04:12 +08:00
|
|
|
$ type sys$input
|
2008-01-04 05:18:14 +08:00
|
|
|
Testing BINARY UI32 - rank 3 - Output LE + CHUNKED
|
2008-01-04 09:38:17 +08:00
|
|
|
$ CALL TOOLTEST "buin32. -c conbuin32. -o" test13.h5
|
2006-08-03 03:08:09 +08:00
|
|
|
$
|
|
|
|
$
|
|
|
|
$
|
|
|
|
$TOOLTEST: SUBROUTINE
|
|
|
|
$
|
2008-01-04 05:04:12 +08:00
|
|
|
$ len = F$LENGTH(P2)
|
|
|
|
$ base = F$EXTRACT(0,len-3,P2)
|
2006-08-03 03:08:09 +08:00
|
|
|
$ actual = base + "out.h5"
|
2008-01-10 06:27:55 +08:00
|
|
|
$ actual_dump = base + "out.h5importtxt"
|
|
|
|
$ actual_dump_err = base + "out.h5importerr"
|
|
|
|
$ expected_dump = base + ".h5importtxt"
|
|
|
|
$ expected_dump_err = base + ".h5importerr"
|
2006-08-03 03:08:09 +08:00
|
|
|
$
|
|
|
|
$ begin = "Testing"
|
|
|
|
$ !
|
|
|
|
$ ! Run h5import with output in the 'actual' file
|
|
|
|
$ !
|
|
|
|
$ ON ERROR THEN CONTINUE
|
2008-01-04 05:04:12 +08:00
|
|
|
$ h5import 'P1 'actual'
|
2006-08-03 03:08:09 +08:00
|
|
|
$ define/nolog sys$output 'actual_dump'
|
|
|
|
$ define/nolog sys$error 'actual_dump_err'
|
|
|
|
$ !
|
|
|
|
$ ! Dump the actual and expected files
|
|
|
|
$ !
|
|
|
|
$ h5dump 'actual'
|
|
|
|
$ deassign sys$output
|
|
|
|
$ deassign sys$error
|
|
|
|
$ if F$SEARCH(actual_dump_err) .NES. ""
|
|
|
|
$ then
|
|
|
|
$ set message/notext/nofacility/noidentification/noseverity
|
|
|
|
$ append 'actual_dump_err' 'actual_dump'
|
2008-01-04 05:04:12 +08:00
|
|
|
$ set message/text/facility/identification/severity
|
2006-08-03 03:08:09 +08:00
|
|
|
$ endif
|
|
|
|
$ define/nolog sys$output 'expected_dump'
|
|
|
|
$ define/nolog sys$error 'expected_dump_err'
|
2008-01-04 05:04:12 +08:00
|
|
|
$ h5dump 'P2
|
2006-08-03 03:08:09 +08:00
|
|
|
$ deassign sys$output
|
|
|
|
$ deassign sys$error
|
|
|
|
$ if F$SEARCH(expected_dump_err) .NES. ""
|
|
|
|
$ then
|
|
|
|
$ set message/notext/nofacility/noidentification/noseverity
|
|
|
|
$ append 'expected_dump_err' 'expected_dump'
|
|
|
|
$ set message/ntext/facility/identification/severity
|
|
|
|
$ endif
|
|
|
|
$ !
|
|
|
|
$ ! Compare the results
|
|
|
|
$ !
|
|
|
|
$ diff/output=h5dump_temp/ignore=(spacing,trailing_spaces,blank_lines)-
|
|
|
|
'actual_dump' -
|
|
|
|
'expected_dump'
|
|
|
|
$ open/read temp_out h5dump_temp.dif
|
|
|
|
$ !
|
|
|
|
$READ_DATA:
|
|
|
|
$ read/end_of_file=end_read temp_out record1
|
|
|
|
$ !
|
|
|
|
$ ! Skip blank lines
|
|
|
|
$ !
|
|
|
|
$ if record1 .EQS. "" then goto READ_DATA
|
|
|
|
$ !
|
|
|
|
$ ! Find record with "Number" and exit the loop
|
|
|
|
$ !
|
|
|
|
$ len = F$LENGTH(record1)
|
|
|
|
$ pos = F$LOCATE("Number", record1)
|
|
|
|
$ !
|
|
|
|
$ if pos .EQ. 0
|
|
|
|
$ then
|
|
|
|
$ err_code = F$EXTRACT(len-1,1,record1)
|
|
|
|
$ goto END_READ
|
|
|
|
$ endif
|
|
|
|
$ !
|
|
|
|
$ goto READ_DATA
|
|
|
|
$
|
|
|
|
$ !
|
|
|
|
$END_READ:
|
|
|
|
$ close temp_out
|
|
|
|
$ !
|
|
|
|
$ ! File names are different, so we allow only one difference
|
|
|
|
$ ! in h5dump
|
|
|
|
$ if err_code .eqs. "1"
|
|
|
|
$ then
|
|
|
|
$ result = "PASSED"
|
|
|
|
$ line = F$FAO("!8AS !62AS !80AS", begin, P1, result)
|
|
|
|
$ else
|
|
|
|
$ result = "*FAILED*"
|
|
|
|
$ line = F$FAO("!8AS !61AS !79AS", begin, P1, result)
|
|
|
|
$ endif
|
|
|
|
$ !
|
|
|
|
$ ! Print test result
|
|
|
|
$ !
|
|
|
|
$ write sys$output line
|
|
|
|
$ !
|
|
|
|
$ ! Append the result to the log file
|
|
|
|
$ !
|
2008-01-04 05:18:14 +08:00
|
|
|
$ append h5dump_temp.dif h5import.log
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
|
|
|
$ ! Delete temporary files
|
|
|
|
$ if F$SEARCH("*out.h5;*") then del *out.h5;*
|
|
|
|
$ if F$SEARCH("*.dif;*") then del *.dif;*
|
2008-01-10 06:27:55 +08:00
|
|
|
$ if F$SEARCH("*.h5importerr;*") then del *.h5importerr;*
|
|
|
|
$ if F$SEARCH("*.h5importtxt;*") then del *.h5importtxt;*
|
2008-01-06 10:42:01 +08:00
|
|
|
$ if F$SEARCH("b*.;*") then del b*.;*
|
|
|
|
$ if F$SEARCH("txti*.;*") then del txti*.;*
|
|
|
|
$ if F$SEARCH("txtu*.;*") then del txtu*.;*
|
|
|
|
$ if F$SEARCH("*.dat;*") then del *.dat;*
|
2006-08-03 03:08:09 +08:00
|
|
|
$ !
|
|
|
|
$ !
|
|
|
|
$ENDSUBROUTINE
|
|
|
|
|