summaryrefslogtreecommitdiffstats
path: root/windows/test/testerr.bat
blob: 18c1e61a103364f6d738ef54d5afa2a08b26050d (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
@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.

@REM This batch file tests HDF5 error API and backward compatibility with 1.6.
@REM If you want to use 1.8 with 1.6 compatibility,To the functionality of error APIs, 
@REM You need to do the following two things:
@REM 1. Uncomment out /*#define H5_WANT_H5_V1_6_COMPAT 1*/ inside h5pubconf.h.
@REM 2. Set up an environment variable H5_WANT_H5_V1_6_COMPAT to 1
@REM Remember to undo 1 and 2 after you test if you are not going to use 1.6 backward compatibility option.
@echo off
@REM Goto the correct directory
cd error_api%2\%1
@REM Copy the executable files
copy /Y ..\..\error_compat%2\%1\error_compat%2.exe . >tempcopy.out 2>tempcopy.err
copy /Y ..\..\testfiles\err* . >tempcopy.out 2>tempcopy.err
@REM use sed to replace the changable number or string(such as line number, thread IDs etc.)
@REM We also want to combine the standard output and standard error of API tests into one file.
@REM Note the different NAME between 1.6 and 1.8...
if "%H5_WANT_H5_V1_6_COMPAT%"=="1" (

error_compat%2 >actual_test.out 2>actual_test.err

sed -e "s/thread [0-9]*/thread (IDs)/" -e "s/: .*\.c /: (file name) /" actual_test.err >temp1.err

sed -e "s/line [0-9]*/line (number)/" -e "s/v[1-9]*\.[0-9]*\./version (number)\./" temp1.err >temp2.err

sed -e "s/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/" temp2.err >temp3.err

more /e actual_test.out >actual_temp.err

more /e temp3.err >>actual_temp.err

error_api%2 >actual_compat.out 2>actual_compat.err

) else (

error_api%2 >actual_test.out 2>actual_test.err

sed -e "s/thread [0-9]*/thread (IDs)/" -e "s/: .*\.c /: (file name) /" actual_test.err >temp1.err

sed -e "s/line [0-9]*/line (number)/" -e "s/v[1-9]*\.[0-9]*\./version (number)\./" temp1.err >temp2.err

sed -e "s/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/" temp2.err >temp3.err

more /e actual_test.out >actual_temp.err

more /e temp3.err >>actual_temp.err

error_compat%2 >actual_compat.out 2>actual_compat.err

)

@REM We also want to filter out the first three lines of the expected output in order to 

@REM get the "no difference output"  between actual and expected results by using fc command.

if "%H5_WANT_H5_V1_6_COMPAT%"=="1" (
	more /e +3 error_test_2 >>err_compat_temp
	more /e +3 err_compat_1 >>expect_temp.err
) else (
	more /e +3 error_test_1 >>expect_temp.err
	more /e +3 err_compat_2 >>err_compat_temp
)

fc actual_temp.err expect_temp.err > fc_temp.out 2>fc_temp.err
if %ERRORLEVEL%==0 (
echo. All error API tests                                                   PASSED
)else (
echo. error API tests                                                       FAILED
)
fc actual_compat.out err_compat_temp > fc_temp.out 2>fc_temp.err
if %ERRORLEVEL%==0 (
echo. All error API compatible tests passed                                 PASSED
)else (
echo. error API compatible tests                                            FAILED
)
del *.err
del *.out
del *temp
del error_compat%2.exe
del *.h5
cd ..\..