From 5e4ca646167c821631ccd5912719e4284b6dc89d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 22 Oct 2009 16:24:15 -0500 Subject: [svn-r17727] Updated the errorlevel checking for better error handling in the windows batch files. --- windows/c++/test/checkcpptests.bat | 21 ++++++++++++++++----- windows/fortran/test/checkfortrantests.bat | 21 ++++++++++++++++----- windows/hdf5bt.BAT | 8 ++++---- windows/hdf5build.BAT | 16 ++++++++++------ windows/hdf5check.BAT | 19 ++++++++++++++----- windows/hl/c++/test/checkhlcpptests.bat | 20 ++++++++++++++++---- windows/hl/fortran/test/checkhlfortrantests.bat | 20 ++++++++++++++++---- windows/hl/test/checkhltests.bat | 20 ++++++++++++++++---- windows/perform/checkperformtests.bat | 20 ++++++++++++++++---- windows/test/checktests.bat | 20 ++++++++++++++++---- windows/test/testerror.bat | 10 ++++++---- windows/tools/checktools.bat | 20 ++++++++++++++++---- 12 files changed, 162 insertions(+), 53 deletions(-) diff --git a/windows/c++/test/checkcpptests.bat b/windows/c++/test/checkcpptests.bat index e092c04..69f1413 100644 --- a/windows/c++/test/checkcpptests.bat +++ b/windows/c++/test/checkcpptests.bat @@ -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 - \ No newline at end of file + endlocal & exit /b %nerrors% diff --git a/windows/fortran/test/checkfortrantests.bat b/windows/fortran/test/checkfortrantests.bat index 2b970f6..d806e7e 100644 --- a/windows/fortran/test/checkfortrantests.bat +++ b/windows/fortran/test/checkfortrantests.bat @@ -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 - \ No newline at end of file + endlocal & exit /b %nerrors% diff --git a/windows/hdf5bt.BAT b/windows/hdf5bt.BAT index ad5e24b..b32a1bb 100755 --- a/windows/hdf5bt.BAT +++ b/windows/hdf5bt.BAT @@ -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 ) diff --git a/windows/hdf5build.BAT b/windows/hdf5build.BAT index b9aac04..05a8f04 100755 --- a/windows/hdf5build.BAT +++ b/windows/hdf5build.BAT @@ -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 ) diff --git a/windows/hdf5check.BAT b/windows/hdf5check.BAT index f3caea2..dc0bb70 100755 --- a/windows/hdf5check.BAT +++ b/windows/hdf5check.BAT @@ -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% diff --git a/windows/hl/c++/test/checkhlcpptests.bat b/windows/hl/c++/test/checkhlcpptests.bat index 24b7f55..aaa8fe2 100644 --- a/windows/hl/c++/test/checkhlcpptests.bat +++ b/windows/hl/c++/test/checkhlcpptests.bat @@ -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% \ No newline at end of file diff --git a/windows/hl/fortran/test/checkhlfortrantests.bat b/windows/hl/fortran/test/checkhlfortrantests.bat index 98d9c38..28d4822 100644 --- a/windows/hl/fortran/test/checkhlfortrantests.bat +++ b/windows/hl/fortran/test/checkhlfortrantests.bat @@ -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% \ No newline at end of file diff --git a/windows/hl/test/checkhltests.bat b/windows/hl/test/checkhltests.bat index 925c245..0804148 100644 --- a/windows/hl/test/checkhltests.bat +++ b/windows/hl/test/checkhltests.bat @@ -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% \ No newline at end of file diff --git a/windows/perform/checkperformtests.bat b/windows/perform/checkperformtests.bat index 35895cf..228dbe5 100644 --- a/windows/perform/checkperformtests.bat +++ b/windows/perform/checkperformtests.bat @@ -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% \ No newline at end of file diff --git a/windows/test/checktests.bat b/windows/test/checktests.bat index d891aad..96bfb6c 100644 --- a/windows/test/checktests.bat +++ b/windows/test/checktests.bat @@ -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% \ No newline at end of file diff --git a/windows/test/testerror.bat b/windows/test/testerror.bat index 844e69c..24d39e0 100644 --- a/windows/test/testerror.bat +++ b/windows/test/testerror.bat @@ -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% diff --git a/windows/tools/checktools.bat b/windows/tools/checktools.bat index f5a5b82..87f30ca 100644 --- a/windows/tools/checktools.bat +++ b/windows/tools/checktools.bat @@ -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% \ No newline at end of file -- cgit v0.12