From 1b60c48c1dfc5df63521d22431879414d0d8d426 Mon Sep 17 00:00:00 2001 From: Fang Guo Date: Wed, 22 Mar 2006 16:02:56 -0500 Subject: [svn-r12135] Purpose: Maintenance on Windows Description: Add in more comments Solution: Platforms tested: Misc. update: --- windows/tools/repacktest.BAT | 30 ++++++++++++++++-- windows/tools/tooltest.bat | 74 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 99 insertions(+), 5 deletions(-) diff --git a/windows/tools/repacktest.BAT b/windows/tools/repacktest.BAT index 8407a70..76108b2 100755 --- a/windows/tools/repacktest.BAT +++ b/windows/tools/repacktest.BAT @@ -21,6 +21,19 @@ :: Written By: Fang GUO :: Date : Jan. 12, 2006 +::What is actually doing? +::Example case +::h5repack -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 h5repack test1.h5 PASSED >> ..\..\repacktest%2_%1.txt +::) else ( +:: echo Testing h5repack test1.h5 FAILED >> ..\..\repacktest%2_%1.txt +:: more temp.txt >> ..\..\repacktest%2_%1.txt +::) + + :: We will check whether the SZIP library available includes encoder or not by :: calling the szip encoder detecting executable file testh5repack_detect_szip(dll).exe @@ -103,6 +116,7 @@ echo. echo.**************************************************** echo. h5repack%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 @@ -110,9 +124,9 @@ echo.**************************************************** ::If we want to test ::h5repack -i ..\..\testfiles\test1.h5 -o ..\..\temptest\out.test1.h5 ::At first, we need to set the flag like -::set flag=-i %test0% -o %output1% +::set flag=-i %test1% -o %output1% ::Secondly, we call batch file tooltest.bat followed by one of reference files -::call %tooltest% %test0% %nodiff% +::call %tooltest% %test1% %notcomp% :: Using Filters (Zlib, SZIP) ::1. Set flag @@ -120,10 +134,13 @@ echo.**************************************************** ::3. Example ::If we want to test ::h5repack -i ..\..\testfiles\test4.h5 -o ..\..\temptest\out.test4.h5 f dset2:SZIP=8,EC -l dset2:CHUNK=20x10 + ::At first, we need to set the flag like ::set flag=-i %test4% -o %output4% f dset2:SZIP=8,EC -l dset2:CHUNK=20x10 + ::Secondly, we call batch file tooltest.bat followed by one of reference files and szip ::call %tooltest% %test4% %nodiff% szip + ::Similarly, if you are using zlib, replace "szip" with "zlib" when calling %tooltest% ::If you are using both zlib and szip, replace "szip" with "zlib szip" when calling %tooltest% ::The order of "zlib szip" does matter. @@ -139,12 +156,21 @@ echo.**************************************************** set flag=-i %test0% -o %output0% call %tooltest% %test0% %nodiff% + +::This case will be used as an example case for +::illustration purpose inside tooltest.bat for repacktest ::-------------- :: test1.h5 ::-------------- + +:: Actually we are doing: +:: set flag=-i ..\..\testfiles\test1.h5 -o ..\..\temptest\out.test1.h5 +:: call ..\..\tooltest ..\..\testfiles\test1.h5 ..\..\temptest\notcomp.txt + set flag=-i %test1% -o %output1% call %tooltest% %test1% %notcomp% + ::-------------- :: test2.h5 ::-------------- diff --git a/windows/tools/tooltest.bat b/windows/tools/tooltest.bat index 698e8d5..00b72e6 100755 --- a/windows/tools/tooltest.bat +++ b/windows/tools/tooltest.bat @@ -26,42 +26,99 @@ set flagmax=65 :: Decide which tool will be test +:: Define an environment variable to decide which test should run + +:: Find string "dll" inside %exefile% and remove it set test_exefile=%exefile:dll=% + if %test_exefile%==h5repack goto REPACK if %test_exefile%==h5diff goto COMMON if %test_exefile%==h5dump goto DUMP if %test_exefile%==h5ls goto COMMON if %test_exefile%==h5import goto IMPORT +:: This block is for Repack test :REPACK ::---------------------------------- ::Test for h5repack or h5repackdll ::---------------------------------- + + :: Get the input parameters + :: Example case for h5repack + :: if %1 is ..\..\testfiles\test1.h5 + :: This line will set variable %testinput% equal to ..\..\testfiles\test1.h5 + set testinput=%1 - set testoutput=..\..\temptest\out.%testinput:~16% + + :: %testinput:~16% will get all of the chars of %testinput% except the first 16 chars + :: Example case: %testinput:~16% will give you test1.h5 + :: The whole line will set varialbe %testoutput% equal to ..\..\temptest\out.test1.h5 + + set testoutput=..\..\temptest\out.%testinput:~16% + + ::Set exp_file equal to the second parameter + :: Example case: %exp_file% will be equal to %nodiff% set exp_file=%2 + + :: Set a variable to be the path to the real output set actual_output=..\..\temptest\temp.txt :: Extract the string for printing results - :: Handle flags with .txt inside + :: Variable flagout is for printing purpose only + :: These lines will get rid of the paths inside %flag% and set it to %flagout% + :: Example case: + :: %flag% was set inside repacktest.bat to + :: "-i ..\..\testfiles\test1.h5 -o ..\..\temptest\out.test1.h5" + :: The following two lines will set %flagout% equal to + :: "-i test1.h5 -o ..\..\temptest\out.test1.h5" + set flagout=%flag:..\..\testfiles\t=t% set flagout=%flagout:..\..\temptest\t=t% + + :: "." will be used as a delimiter in the for loop for printing output + :: But "." inside ".txt" and".." will not be treated as a delimiter. So replace it + :: with a "#" and recover it before printing results. + set flagout=%flagout:.txt=#txt% set flagout=%flagout:..=##% + :: This for loop uses "." as a delimiter and gets the first and the fourth tokens + :: and assign it to var1 and var4 + ::Example case: + :: %flagout% now is "-i test1.h5 -o ##\##\temptest\out.test1.h5" + :: This for loop will set %var1% as "-i test1" and %var4% as "h5" + for /f "tokens=1,4 delims=." %%a in ("%flagout%") do ( set var1=%%a set var4=%%b ) + + ::Add in extension for input file + ::Example case: %var1% is "-i test1" in previous step + :: This step will set %var1% as %var1% as "-i test1.h5" set var1=%var1%.h5 + + ::Check for output file name + ::Example case: %var4% is ".h5" in previous step + ::This step will set it to nothing set var4=%var4:~2% + + ::Check if %var4% is blank, we will print the "flagout" with the "var1" only if "%var4%"=="" ( set flagout=%var1% goto CHOICE ) + + ::If %var4% is not blank, for example in the "file test" we have flags like + ::set flag=-i %test4% -o %output4% -e ..\..\testfiles\h5repack_info.txt + ::In this case, we want to print the %var4% out + ::Recover "." set var4=%var4:#=.% set flagout=%var1% %var4% + ::Based on the third parameter, we will go to different part. + :: GTEST means general test, no need to check zlib and szlib + :CHOICE if "%3"=="" goto GTEST if "%3"=="SKIP" goto SKIP @@ -94,12 +151,23 @@ ) goto SKIP + ::Run the .exe file with the specified flag and generate %testoutput% + ::Compare the expected and the actual output and save the comparison + ::results into .\..\temptest\temp.txt(%actual_output%) + ::Example case: + ::Expected output(%testinput%) is "..\..\testfiles\test1.h5" + ::Actual output(%testoutput%) is "..\..\temptest\out.test1.h5" + ::Save the comparion results into .\..\temptest\temp.txt + :GTEST %exefile% %flag% ..\..\h5diff%p2%\%p1%\h5diff%p2% %testinput% %testoutput% > %actual_output% 2>&1 goto RESULTS - +:: End of Repack tests + + +::H5diff and H5ls Tests :COMMON :: ------------------------------------------------------ :: Test for Tools which only need to run .exe and compare -- cgit v0.12