and also use @ to suppress command output

This commit is contained in:
Geoff McLane 2015-05-13 12:40:46 +02:00
parent 761964caa8
commit 40824e9a68

View file

@ -1,68 +1,90 @@
@echo off @setlocal
@REM echo off
REM execute a single test case of the accessibility test suite @REM execute a single test case of the accessibility test suite
REM @REM
REM (c) 2006 (W3C) MIT, ERCIM, Keio University @REM (c) 2006 (W3C) MIT, ERCIM, Keio University
REM See tidy.c for the copyright notice. @REM See tidy.c for the copyright notice.
REM @REM
REM <URL:http://www.html-tidy.org/> @REM <URL:http://www.html-tidy.org/>
REM @REM
@echo Testing %1 %2 %3
@set TESTNO=%1
@set TESTEXPECTED=%2
@set ACCESSLEVEL=%3
@if "%1x" == "x" goto NOTEST
@if "%2x" == "x" goto NOEXPECT
@if "%3x" == "x" goto NOLEVEL
@if "%TIDYLOG%x" == "x" goto NOLOG
echo Testing %1 %2 %3 @set INFILES=%TIDYINPUT%\%1.*ml
set TESTNO=%1 @set CFGFILE=%TIDYINPUT%\cfg_%1.txt
set TESTEXPECTED=%2
set ACCESSLEVEL=%3
set INFILES=%TIDYINPUT%\%1.*ml @set TIDYFILE=%TIDYOUT%\out_%1.html
set CFGFILE=%TIDYINPUT%\cfg_%1.txt @set MSGFILE=%TIDYout%\msg_%1.txt
set TIDYFILE=%TIDYOUT%\out_%1.html @set HTML_TIDY=
set MSGFILE=%TIDYout%\msg_%1.txt
set HTML_TIDY= @REM If no test specific config file, use default.
@if NOT exist %CFGFILE% @set CFGFILE=%TIDYINPUT%\cfg_default.txt
REM If no test specific config file, use default. @REM Get specific input file name
if NOT exist %CFGFILE% set CFGFILE=%TIDYINPUT%\cfg_default.txt @for %%F in ( %INFILES% ) do @set INFILE=%%F
REM Get specific input file name @if EXIST %INFILE% goto DOIT
for %%F in ( %INFILES% ) do set INFILE=%%F
if EXIST %INFILE% goto DOIT
@echo ERROR: Can NOT locate [%INFILE%] ... aborting test ... @echo ERROR: Can NOT locate [%INFILE%] ... aborting test ...
@echo ======================================= >> ACCERR.TXT @echo ======================================= >> %TIDYLOG%
@echo Testing %1 %2 %3 >> ACCERR.TXT @echo Testing %1 %2 %3 >> %TIDYLOG%
@echo ERROR: Can NOT locate [%INFILE%] ... aborting test ... >> ACCERR.TXT @echo ERROR: Can NOT locate [%INFILE%] ... aborting test ... >> %TIDYLOG%
@goto done @goto done
:DOIT :DOIT
REM Remove any pre-existing test outputs @REM Remove any pre-existing test outputs
if exist %MSGFILE% del %MSGFILE% @if exist %MSGFILE% del %MSGFILE%
if exist %TIDYFILE% del %TIDYFILE% @if exist %TIDYFILE% del %TIDYFILE%
REM this has to all one line ... @REM this has to all one line ...
%TIDY% -f %MSGFILE% --accessibility-check %ACCESSLEVEL% -config %CFGFILE% --gnu-emacs yes --tidy-mark no -o %TIDYFILE% %INFILE% @%TIDY% -f %MSGFILE% --accessibility-check %ACCESSLEVEL% -config %CFGFILE% --gnu-emacs yes --tidy-mark no -o %TIDYFILE% %INFILE%
@REM output the FIND count to the a result file @REM output the FIND count to the a result file
find /c "%TESTEXPECTED%" %MSGFILE% > tempres.txt @find /c "%TESTEXPECTED%" %MSGFILE% > tempres.txt
@REM load the find count, token 3, into variable RESULT @REM load the find count, token 3, into variable RESULT
for /F "tokens=3" %%i in (tempres.txt) do set RESULT=%%i @for /F "tokens=3" %%i in (tempres.txt) do @set RESULT=%%i
@REM test the RESULT variable ... @REM test the RESULT variable ...
if "%RESULT%." == "0." goto Err @if "%RESULT%." == "0." goto Err
if "%RESULT%." == "1." goto done @if "%RESULT%." == "1." goto done
@REM echo note - test '%TESTEXPECTED%' found %RESULT% times in file '%INFILE%' @REM echo note - test '%TESTEXPECTED%' found %RESULT% times in file '%INFILE%'
goto done @goto done
:Err :Err
echo FAILED --- test '%TESTEXPECTED%' not detected in file '%INFILE%' @echo FAILED --- test '%TESTEXPECTED%' not detected in file '%INFILE%'
type %MSGFILE% @type %MSGFILE%
echo FAILED --- test '%TESTEXPECTED%' not detected in above @echo FAILED --- test '%TESTEXPECTED%' not detected in above
set FAILEDACC=%FAILEDACC% %1 @set FAILEDACC=%FAILEDACC% %1
REM append results to the ACCERR.TXT file @REM append results to the ACCERR.TXT file
echo ======================================= >> ACCERR.TXT @echo ======================================= >> %TIDYLOG%
echo %TIDY% -f %MSGFILE% --accessibility-check %ACCESSLEVEL% -config %CFGFILE% --gnu-emacs yes --tidy-mark no -o %TIDYFILE% %INFILE% >> ACCERR.TXT @echo %TIDY% -f %MSGFILE% --accessibility-check %ACCESSLEVEL% -config %CFGFILE% --gnu-emacs yes --tidy-mark no -o %TIDYFILE% %INFILE% >> %TIDYLOG%
echo FAILED --- test '%TESTEXPECTED%' not detected in file '%MSGFILE%', as follows - >> ACCERR.TXT @echo FAILED --- test '%TESTEXPECTED%' not detected in file '%MSGFILE%', as follows - >> %TIDYLOG%
type %MSGFILE% >> ACCERR.TXT @type %MSGFILE% >> %TIDYLOG%
echo FAILED --- test '%TESTEXPECTED%' not detected in above >> ACCERR.TXT @echo FAILED --- test '%TESTEXPECTED%' not detected in above >> %TIDYLOG%
goto done @goto done
:NOTEST
@echo Error: NO test number given as the first command!
:NOEXPECT
@echo Error: NO expected result given as the second command!
:NOLEVEL
@echo Error: NO accesslevel given as the thrid command!
@goto HELP
:NOLOG
@echo.
@echo Error: TIDYLOG NOT set in the environment!!! This is set in acctest.cmd
:HELP
@echo The file acctest.cmd should be used to run this cmd...
@echo Use Ctrl+c to abort, to fix...
@pause
@goto NOLOG
:done :done
@endlocal