[svn-r17727] Updated the errorlevel checking for better error handling in the windows batch files.

This commit is contained in:
Allen Byrne
2009-10-22 16:24:15 -05:00
parent 5f87e53d04
commit 5e4ca64616
12 changed files with 162 additions and 53 deletions

View File

@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
set /a nerrors=0
rem Clean any variables starting with "HDF5_CPPTEST_", as we use these for our
rem tests. Also clear "HDF5_CPPTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_cpptest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
if !errorlevel! neq 0 exit /b
if errorlevel 1 (
set /a nerrors=!nerrors!+1
echo.
echo.************************************
echo. Testing %%a ^(%1 %2^) FAILED
exit /b 1
)
)
rem If we get here, that means all of our tests passed.
echo.All C++ library tests passed.
exit /b
@@ -83,6 +89,11 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
if "%nerrors%"=="0" (
echo.All C++ library tests passed.
) else (
echo.** FAILED C++ library tests.
)
popd
endlocal & exit /b
endlocal & exit /b %nerrors%

View File

@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
set /a nerrors=0
rem Clean any variables starting with "HDF5_FORTTEST_", as we use these for our
rem tests. Also clear "HDF5_FORTTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_forttest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
if !errorlevel! neq 0 exit /b
if errorlevel 1 (
set /a nerrors=!nerrors!+1
echo.
echo.************************************
echo. Testing %%a ^(%1 %2^) FAILED
exit /b 1
)
)
rem If we get here, that means all of our tests passed.
echo.All Fortran library tests passed.
exit /b
@@ -86,6 +92,11 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
if "%nerrors%"=="0" (
echo.All Fortran library tests passed.
) else (
echo.** FAILED Fortran library tests.
)
popd
endlocal & exit /b
endlocal & exit /b %nerrors%

View File

@@ -228,7 +228,7 @@ rem This is where the magic happens
call :parse_params %*
if %errorlevel% neq 0 (
if !errorlevel! equ 1 (
if %errorlevel% equ 1 (
rem This isn't an error case-- this means /? was specified. Simply
rem quit.
goto end
@@ -241,7 +241,7 @@ rem This is where the magic happens
)
call :setup
if %errorlevel% neq 0 (
if not errorlevel 0 (
echo.Error setting up hdf5bt environment!
goto error
)
@@ -252,13 +252,13 @@ rem This is where the magic happens
echo.
call :build
if %errorlevel% neq 0 (
if not errorlevel 0 (
echo.Error building HDF5 libraries!
goto error
)
call :test
if %errorlevel% neq 0 (
if not errorlevel 0 (
echo.Error testing HDF5 libraries!
goto error
)

View File

@@ -303,7 +303,11 @@ rem Build the HDF5 libraries. By default, C and C++ libraries are built.
) else (
devenv %hdf5_sln% %ccflags% /rebuild "%%a|%hdf5_platform%"
)
if !errorlevel! neq 0 exit /b
if not errorlevel 0 (
set /a nerrors=!nerrors!+1
echo. Building %%a FAILED
exit /b 1
)
)
exit /b
@@ -325,8 +329,8 @@ rem This is where the magic happens
:main
call :parse_params %*
if %errorlevel% neq 0 (
if !errorlevel! equ 1 (
if not errorlevel 0 (
if errorlevel 1 (
rem This isn't an error case-- this means /? was specified. Simply
rem quit.
goto end
@@ -339,7 +343,7 @@ rem This is where the magic happens
)
call :setup
if %errorlevel% neq 0 (
if not errorlevel 0 (
echo.Error setting up build environment.
goto error
)
@@ -347,7 +351,7 @@ rem This is where the magic happens
rem Upgrade the project files if needed
if defined hdf5_vs2008 (
call :upgrade
if !errorlevel! neq 0 (
if not errorlevel 0 (
echo.Error upgrading project files!
goto error
)
@@ -363,7 +367,7 @@ rem This is where the magic happens
call :all
if %errorlevel% neq 0 (
if not errorlevel (
echo.Error building HDF5 libraries!
goto error
)

View File

@@ -75,14 +75,19 @@ rem %2 - "dll" or nothing
:run_tests
for %%a in (%hdf5_test_tests%) do (
echo.
echo.************************************
echo.**==**==**==**==**==**==**==**==**==**
echo. Testing %%a ^(%1 %2^)
echo.************************************
echo.**==**==**==**==**==**==**==**==**==**
rem Only add our parameters for batch scripts.
call !hdf5_test_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
if !errorlevel! neq 0 exit /b
if errorlevel 1 (
set /a nerrors=!nerrors!+1
echo. Testing %%a ^(%1 %2^) FAILED
echo.**==**==**==**==**==**==**==**==**==**
exit /b 1
)
)
rem If we get here, that means all of our tests passed.
@@ -118,6 +123,7 @@ rem on it for sending parameters. --SJW 9/6/07
rem We use "nodll" here because we cannot simply leave it blank. Filter
rem it out below. --SJW 9/10/07
for %%b in (nodll dll) do (
echo.======================================
for %%a in (debug release) do (
set hdf5_config=%%a %%b
call :run_tests !hdf5_config:nodll=!
@@ -125,11 +131,14 @@ rem on it for sending parameters. --SJW 9/6/07
set /a nerrors=!nerrors!+1
)
)
echo.======================================
)
if %nerrors% equ 0 (
if "%nerrors%"=="0" (
echo.HDF5 Tests passed for all configurations!
)
) else (
echo.** FAILED HDF5 Tests!
)
popd
endlocal & exit /b %nerrors%

View File

@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
set /a nerrors=0
rem Clean any variables starting with "HDF5_HLCPPTEST_", as we use these for our
rem tests. Also clear "HDF5_HLCPPTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_hlcpptest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
if !errorlevel! neq 0 exit /b
if errorlevel 1 (
set /a nerrors=!nerrors!+1
echo.
echo.************************************
echo. Testing %%a ^(%1 %2^) FAILED
exit /b 1
)
)
rem If we get here, that means all of our tests passed.
echo.All HL C++ library tests passed.
exit /b
@@ -82,6 +88,12 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
if "%nerrors%"=="0" (
echo.All HL C++ library tests passed.
) else (
echo.** FAILED HL C++ Library tests.
)
popd
endlocal & exit /b
endlocal & exit /b %nerrors%

View File

@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
set /a nerrors=0
rem Clean any variables starting with "HDF5_HLFORTTEST_", as we use these for our
rem tests. Also clear "HDF5_HLFORTTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_hlforttest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
if !errorlevel! neq 0 exit /b
if errorlevel 1 (
set /a nerrors=!nerrors!+1
echo.
echo.************************************
echo. Testing %%a ^(%1 %2^) FAILED
exit /b 1
)
)
rem If we get here, that means all of our tests passed.
echo.All HL Fortran library tests passed.
exit /b
@@ -84,6 +90,12 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
if "%nerrors%"=="0" (
echo.All HL Fortran library tests passed.
) else (
echo.** FAILED HL Fortran Library tests.
)
popd
endlocal & exit /b
endlocal & exit /b %nerrors%

View File

@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
set /a nerrors=0
rem Clean any variables starting with "HDF5_HLTEST_", as we use these for our
rem tests. Also clear "HDF5_HLTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -66,12 +68,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_hltest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
if !errorlevel! neq 0 exit /b
if errorlevel 1 (
set /a nerrors=!nerrors!+1
echo.
echo.************************************
echo. Testing %%a ^(%1 %2^) FAILED
exit /b 1
)
)
rem If we get here, that means all of our tests passed.
echo.All HL library tests passed.
exit /b
@@ -134,6 +140,12 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
if "%nerrors%"=="0" (
echo.All HL library tests passed.
) else (
echo.** FAILED HL Library tests.
)
popd
endlocal & exit /b
endlocal & exit /b %nerrors%

View File

@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
set /a nerrors=0
rem Clean any variables starting with "HDF5_PERFTEST_", as we use these for our
rem tests. Also clear "HDF5_PERFTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_perftest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
if !errorlevel! neq 0 exit /b
if errorlevel 1 (
set /a nerrors=!nerrors!+1
echo.
echo.************************************
echo. Testing %%a ^(%1 %2^) FAILED
exit /b 1
)
)
rem If we get here, that means all of our tests passed.
echo.All performance tests passed.
exit /b
@@ -85,6 +91,12 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
if "%nerrors%"=="0" (
echo.All performance tests passed.
) else (
echo.** FAILED performance tests.
)
popd
endlocal & exit /b
endlocal & exit /b %nerrors%

View File

@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
set /a nerrors=0
rem Clean any variables starting with "HDF5_LIBTEST_", as we use these for our
rem tests. Also clear "HDF5_LIBTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_libtest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
if !errorlevel! neq 0 exit /b
if errorlevel 1 (
set /a nerrors=!nerrors!+1
echo.
echo.************************************
echo. Testing %%a ^(%1 %2^) FAILED
exit /b 1
)
)
rem If we get here, that means all of our tests passed.
echo.All library tests passed.
exit /b
@@ -128,6 +134,12 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
if "%nerrors%"=="0" (
echo.All library tests passed.
) else (
echo.** FAILED Library tests.
)
popd
endlocal & exit /b
endlocal & exit /b %nerrors%

View File

@@ -146,11 +146,11 @@ rem
)
fc /w %expect1_parsed% %actual% > nul
if %errorlevel% equ 0 (
if errorlevel 0 (
call :testing PASSED %test_err%
) else (
fc /w %expect2_parsed% %actual% > nul
if !errorlevel! equ 0 (
if errorlevel 0 (
call :testing PASSED %test_err%
) else (
call :testing *FAILED* %test_err%
@@ -193,9 +193,11 @@ rem ############################################################################
rem test for error_test
call :test error_test %1 %2
if %nerrors% equ 0 (
if "%nerrors%"=="0" (
echo.All Error API tests passed.
)
) else (
echo.** FAILED Error API tests
)
popd
endlocal & exit /b %nerrors%

View File

@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
set /a nerrors=0
rem Clean any variables starting with "HDF5_TOOL_", as we use these for our
rem tests. Also clear "HDF5_TOOL_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_tool_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
if !errorlevel! neq 0 exit /b
if errorlevel 1 (
set /a nerrors=!nerrors!+1
echo.
echo.************************************
echo. Testing %%a ^(%1 %2^) FAILED
exit /b 1
)
)
rem If we get here, that means all of our tests passed.
echo.All tool tests passed.
exit /b
@@ -147,6 +153,12 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
if "%nerrors%"=="0" (
echo.All tool tests passed.
) else (
echo.** FAILED tool tests.
)
popd
endlocal & exit /b
endlocal & exit /b %nerrors%