From a88a102d5c05b97291b071e336472ce4da52439b Mon Sep 17 00:00:00 2001 From: MuQun Yang Date: Wed, 25 Oct 2006 15:11:29 -0500 Subject: [svn-r12812] Add h5copy tool tests for windows. --- windows/tools/copytest.BAT | 193 ++++++++++++++++++++++++++++++++++++++++ windows/tools/testhdf5tools.BAT | 8 +- windows/tools/tooltest.bat | 19 +++- 3 files changed, 216 insertions(+), 4 deletions(-) create mode 100644 windows/tools/copytest.BAT diff --git a/windows/tools/copytest.BAT b/windows/tools/copytest.BAT new file mode 100644 index 0000000..3050518 --- /dev/null +++ b/windows/tools/copytest.BAT @@ -0,0 +1,193 @@ +@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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have +@REM access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. + +@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= +) + + diff --git a/windows/tools/testhdf5tools.BAT b/windows/tools/testhdf5tools.BAT index 962b069..2c19474 100755 --- a/windows/tools/testhdf5tools.BAT +++ b/windows/tools/testhdf5tools.BAT @@ -46,10 +46,16 @@ call importtest %1 %2 call repacktest %1 %2 @more repacktest%2_%1.txt >> toolstest_%1%2.txt @del repacktest%2_%1.txt + +call stattest %1 %2 +@more stattest%2_%1.txt >> toolstest_%1%2.txt +@del stattest%2_%1.txt + set p2=%2 if "%2"=="dll" ( -echo "DLL version is not available for h5jam or h5unjam, SKIP the test" +echo "DLL version is not available for h5copy,h5jam or h5unjam, SKIP the test" ) else ( call jamtest %1 %2 + call copytest %1 %2 ) diff --git a/windows/tools/tooltest.bat b/windows/tools/tooltest.bat index 2a9d448..854f7a8 100755 --- a/windows/tools/tooltest.bat +++ b/windows/tools/tooltest.bat @@ -34,7 +34,8 @@ :: Find string "dll" inside %exefile% and remove it set test_exefile=%exefile:dll=% - if %test_exefile%==h5repack goto REPACK + if %test_exefile%==h5repack goto REPACKCOPY + if %test_exefile%==h5copy goto REPACKCOPY if %test_exefile%==h5diff goto COMMON if %test_exefile%==h5dump goto DUMP if %test_exefile%==h5ls goto COMMON @@ -42,7 +43,8 @@ if %test_exefile%==h5import goto IMPORT :: This block is for Repack test -:REPACK +:REPACKCOPY + ::---------------------------------- ::Test for h5repack or h5repackdll ::---------------------------------- @@ -119,7 +121,13 @@ ::Recover "." set var4=%var4:#=.% set flagout=%var1% %var4% - + + if %test_exefile%==h5copy ( + set testoutput=..\..\testfiles\out.h5copytst.h5 + goto GTEST + ) + + if %test_exefile%==h5copy goto GTEST ::Based on the third parameter, we will go to different part. :: GTEST means general test, no need to check zlib and szlib @@ -166,10 +174,15 @@ :GTEST %exefile% %flag% ..\..\h5diff%p2%\%p1%\h5diff%p2% %testinput% %testoutput% > %actual_output% 2>&1 + if %test_exefile%==h5copy ( + del %testoutput% + ) goto RESULTS :: End of Repack tests +:: h5copy tests + ::H5diff and H5ls Tests :COMMON -- cgit v0.12