summaryrefslogtreecommitdiffstats
path: root/windows/tools/copytest.BAT
blob: 23154566f8bbfc8ae188faf28a4bb9a8b84be551 (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
@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=
)