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
|
@if "%_echo%"=="" echo off
setlocal
set ERRORMSG=
call %~d0%~p0..\config.bat
if errorlevel 1 (
set ERRORMSG=%ERRORMSG% config.bat failed;
goto :ERROR
)
if not exist "%FSC%" (
set ERRORMSG=Could not find FSC at path "%FSC%"
goto :ERROR
)
%FSDIFF% %~f0 %~f0
@if ERRORLEVEL 1 (
set ERRORMSG=%ERRORMSG% FSDIFF likely not found;
goto Error
)
set testname=%1
REM == Set baseline (fsc vs vs, in case the vs baseline exists)
IF EXIST %testname%.vsbsl (set BSLFILE=%testname%.vsbsl)
IF NOT EXIST %testname%.vsbsl (set BSLFILE=%testname%.bsl)
set sources=
if exist "%testname%.mli" (set sources=%sources% %testname%.mli)
if exist "%testname%.fsi" (set sources=%sources% %testname%.fsi)
if exist "%testname%.ml" (set sources=%sources% %testname%.ml)
if exist "%testname%.fs" (set sources=%sources% %testname%.fs)
if exist "%testname%.fsx" (set sources=%sources% %testname%.fsx)
if exist "%testname%a.mli" (set sources=%sources% %testname%a.mli)
if exist "%testname%a.fsi" (set sources=%sources% %testname%a.fsi)
if exist "%testname%a.ml" (set sources=%sources% %testname%a.ml)
if exist "%testname%a.fs" (set sources=%sources% %testname%a.fs)
if exist "%testname%b.mli" (set sources=%sources% %testname%b.mli)
if exist "%testname%b.fsi" (set sources=%sources% %testname%b.fsi)
if exist "%testname%b.ml" (set sources=%sources% %testname%b.ml)
if exist "%testname%b.fs" (set sources=%sources% %testname%b.fs)
if exist "helloWorldProvider.dll" (set sources=%sources% -r:helloWorldProvider.dll)
REM check negative tests for bootstrapped fsc.exe due to line-ending differences
if "%FSC:fscp=X%" == "%FSC%" (
echo Negative typechecker testing: %testname%
echo "%FSC%" %fsc_flags% --vserrors --warnaserror --nologo --maxerrors:10000 -a -o:%testname%.dll %sources%
"%FSC%" %fsc_flags% --vserrors --warnaserror --nologo --maxerrors:10000 -a -o:%testname%.dll %sources% 2> %testname%.err
@if NOT ERRORLEVEL 1 (
set ERRORMSG=%ERRORMSG% FSC passed unexpectedly for %sources%;
goto SetError
)
%FSDIFF% %testname%.err %testname%.bsl > %testname%.diff
for /f %%c IN (%testname%.diff) do (
echo ***** %testname%.err %testname%.bsl differed: a bug or baseline may neeed updating
set ERRORMSG=%ERRORMSG% %testname%.err %testname%.bsl differ;
IF DEFINED WINDIFF (start %windiff% %testname%.bsl %testname%.err)
goto SetError
)
echo Good, output %testname%.err matched %testname%.bsl
echo "%FSC%" %fsc_flags% --test:ContinueAfterParseFailure --vserrors --warnaserror --nologo --maxerrors:10000 -a -o:%testname%.dll %sources%
"%FSC%" %fsc_flags% --test:ContinueAfterParseFailure --vserrors --warnaserror --nologo --maxerrors:10000 -a -o:%testname%.dll %sources% 2> %testname%.vserr
@if NOT ERRORLEVEL 1 (
set ERRORMSG=%ERRORMSG% FSC passed unexpectedly for %sources%;
goto SetError
)
%FSDIFF% %testname%.vserr %BSLFILE% > %testname%.vsdiff
for /f %%c IN (%testname%.vsdiff) do (
echo ***** %testname%.vserr %BSLFILE% differed: a bug or baseline may neeed updating
set ERRORMSG=%ERRORMSG% %testname%.vserr %BSLFILE% differ;
IF DEFINED WINDIFF (start %windiff% %BSLFILE% %testname%.vserr)
goto SetError
)
echo Good, output %testname%.vserr matched %BSLFILE%
)
:Ok
echo Ran fsharp %~f0 ok.
endlocal
exit /b 0
goto :EOF
:Skip
echo Skipped %~f0
endlocal
exit /b 0
goto :EOF
:Error
call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0 "%ERRORMSG%"
exit /b %ERRORLEVEL%
goto :EOF
:SETERROR
set NonexistentErrorLevel 2> nul
goto Error
goto :EOF
:Check
for /f %%i in ("%1") do (
dir %%i > NUL 2>&1 || (
set ERRORMSG=%ERRORMSG% %1 was not found;
)
)
goto :EOF
|