hdf5/windows/tools/copytest.BAT

195 lines
6.4 KiB
Batchfile

@REM Copyright by The HDF Group.
@REM Copyright by the Board of Trustees of the University of Illinois.
@REM All rights reserved.
@REM
@REM This file is part of HDF5. The full HDF5 copyright notice, including
@REM terms governing use, modification, and redistribution, is contained in
@REM the files COPYING and Copyright.html. COPYING can be found at the root
@REM of the source code distribution tree; Copyright.html can be found at the
@REM root level of an installed copy of the electronic HDF5 document set and
@REM is linked from the top-level documents page. It can also be found at
@REM http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
@REM access to either file, you may request a copy from help@hdfgroup.org.
@echo off
::This batch file is for h5repack tests
::Usage
:: copytest release -- release static version
:: copytest debug -- debug static version
:: copytest release dll -- release dll version
:: copytest debug dll -- debug dll version
:: Written By: MUQUN YANG
:: Date : Oct. 19, 2006
::What is actually doing?
::Example case
::h5copy -i ..\..\testfiles\test1.h5 -o ..\..\temptest\out.test1.h5
::h5diff ..\..\testfiles\test1.h5 ..\..\temptest\out.test1.h5 > ..\..\temptest\temp.txt 2>&1
::fc ..\..\temptest\temp.txt temptest\notcomp.txt
::if %ERRORLEVEL%==0 (
:: echo Testing h5copy test1.h5 PASSED >> ..\..\copytest%2_%1.txt
::) else (
:: echo Testing h5copy test1.h5 FAILED >> ..\..\copytest%2_%1.txt
:: more temp.txt >> ..\..\copytest%2_%1.txt
::)
:: Track total number of testing errors
set /A totalerr=0
set /A totalskip=0
::*******************************************************************
:: Generate a new temp directory for test h5copy and reference file
::*******************************************************************
::Make a temporary directory for testing h5copy
mkdir temptest
:: Reference Files
:: After running h5copy with a input .h5 file, it will use
:: h5diff to compare the expected .h5 file with the output
:: .h5 file generated by h5copy. The comparison results will be
:: one of the following two cases.
:: Case 1: No difference between the expected .h5 and .h5 generated by h5copy file
type nul > temptest\empty.txt
::Case 2: For test1.h5 and test2.h5, the output will be "Some objects
:: are not comparable", but actually there is no difference between
type nul > temptest\notcomp.txt
echo -------------------------------->>temptest\notcomp.txt
echo Some objects are not comparable>> temptest\notcomp.txt
echo -------------------------------->>temptest\notcomp.txt
echo Use -v for a list of objects.>> temptest\notcomp.txt
:: Set two variables to contain the following two file names and paths
set nodiff=..\..\temptest\empty.txt
set notcomp=..\..\temptest\notcomp.txt
::****************************************************
:: Set the Environment Variables & Change Dir to .EXE
::****************************************************
:: The first incoming parameter should be configuration (debug or release)
set p1=%1
:: The second parameter should be the types of library (dll or blank)
set p2=%2
:: Set file name for the test results
set tempResults=copytest%2_%1.txt
:: Set exe file name
set exefile=h5copy%p2%
:: Set a variable for the sub batch file tools\tooltest.bat
set tooltest=..\..\tooltest
set test0=..\..\testfiles\h5copytst.h5
set output0=..\..\testfiles\out.h5copytst.h5
:: Creat the file for saving the tests results
type nul > %tempResults%
:: Change to the direcotory where the .exe file is located
cd h5copy%p2%\%p1%
::*********************************************
:: Test each function by calling TOOLTEST.BAT
::*********************************************
echo.
echo.****************************************************
echo. h5copy%2 %1 T E S T S
echo.****************************************************
::Basic Usage:
::1. Set flag
::2. Call batch file tooltest.bat followed with the expected file name
::3. Example
::If we want to test
::h5copy -i ..\..\testfiles\test1.h5 -o ..\..\temptest\out.test1.h5
::At first, we need to set the flag like
::set flag=-i %test1% -o %output1%
::Secondly, we call batch file tooltest.bat followed by one of reference files
::call %tooltest% %test1% %notcomp%
::--------------
:: case1: simple
::--------------v
set flag=-i %test0% -o %output0% -v -s simple -d simple
call %tooltest% %test0% %nodiff%
::--------------
:: case2: chunk
::--------------
set flag=-i %test0% -o %output0% -v -s chunk -d chunk
call %tooltest% %test0% %nodiff%
::--------------
:: case3: compact
::--------------
set flag=-i %test0% -o %output0% -v -s compact -d compact
call %tooltest% %test0% %nodiff%
::--------------
:: case4: compound
::--------------
set flag=-i %test0% -o %output0% -v -s compound -d compound
call %tooltest% %test0% %nodiff%
::--------------
:: case4: compressed
::--------------
set flag=-i %test0% -o %output0% -v -s compressed -d compressed
call %tooltest% %test0% %nodiff%
::--------------
:: case5: named_vl
::--------------
set flag=-i %test0% -o %output0% -v -s named_vl -d named_vl
call %tooltest% %test0% %nodiff%
::--------------
:: case6: nested_vl
::--------------
set flag=-i %test0% -o %output0% -v -s nested_vl -d nested_vl
call %tooltest% %test0% %nodiff%
cd ..\..
echo.
::Tests how many tests failed and how many tests skiped
if %totalerr%==0 (
echo. All of the %exefile% %p1% Tests Passed!
echo. All of the %exefile% %p1% Tests Passed! >> %tempResults%
) else (
echo. %exefile% %p1% Tests Finished with %totalerr% Errors!
echo. %exefile% %p1% Tests Finished with %totalerr% Errors!>> %tempResults%
)
if not %totalskip%==0 (
echo. %totalskip% Tests in total Skiped! >> %tempResults%
echo. %totalskip% Tests in total Skiped!
echo.
find "SKIPED" %tempResults% | more +2
)
:: remove direcotory temptest and all its contents
rmdir /s/q temptest
:: Clean environment variables
for %%v in (p1 p2 tempResults exefile tooltest nodiff notcomp totalerr totalskip) do set %%v=
for %%v in (0 1 2 3 4 5 _szip _deflate _shuffle _fletcher32 _nbit _scaleoffset _all) do (
set test%%v=
set output%%v=
)