From 2cf5bff32dd93cdc0091a2c3c6ca42a27d212372 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 30 Dec 2020 17:58:43 +0100 Subject: [PATCH] Fix negative error code termination for MSVS (See #86) --- tests/Make-check-cl.bat | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/Make-check-cl.bat b/tests/Make-check-cl.bat index 10cb85d4..fc7191d4 100644 --- a/tests/Make-check-cl.bat +++ b/tests/Make-check-cl.bat @@ -55,8 +55,9 @@ for %%f in (test-*.c) do ( echo ================================================= echo Testing %%f REM Copy the test file as a C++ file as CL.EXE only support C++ file + del test.exe copy %%f test.cpp - if ERRORLEVEL 1 EXIT /B 1 + if not ERRORLEVEL 0 EXIT /B 1 REM Compile the test suite REM /Zc:preprocessor is mandatory to have a compliant preprocessor REM /Zc:__cplusplus is needed to report the real value of __cplusplus, so that M*LIB uses the C++ atomic, and not its emulation. @@ -64,7 +65,7 @@ for %%f in (test-*.c) do ( REM Inform M*LIB to use Annex K by defining __STDC_WANT_LIB_EXT1__ echo Compiling %%f with %compiler% %compiler% /I.. /O2 /W3 /std:c++14 /Zc:__cplusplus /Zc:preprocessor /D__STDC_WANT_LIB_EXT1__ test.cpp > %%f.log 2>&1 - if ERRORLEVEL 1 ( + if not ERRORLEVEL 0 ( echo *** BUILD ERROR for %%f *** >> %%f.log type %%f.log if /i "%%f" NEQ "%expectedFailure1%" if /i "%%f" NEQ "%expectedFailure2%" EXIT /B 1 @@ -72,10 +73,10 @@ for %%f in (test-*.c) do ( REM Execute it echo Running %%f test.exe >> %%f.log 2>&1 - if ERRORLEVEL 1 ( + if not ERRORLEVEL 0 ( echo *** RUNTIME ERROR for %%f *** >> %%f.log type %%f.log - if /i "%%f" NEQ "%expectedFailure%" EXIT /B 1 + if /i "%%f" NEQ "%expectedFailure%" if /i "%%f" NEQ "%expectedFailure2%" EXIT /B 1 ) ELSE ( echo Test OK for %%f >> %%f.log )