hgattic / runtests.bat

Full commit
@echo off
rem runtests.bat - command line test runner
rem Copyright 2009 Bill Barry <>
rem This software may be used and distributed according to the terms
rem of the GNU General Public License, incorporated herein by reference.

rem This program will run all the test files in a tests subdirectory.
rem   A test is a batch script in the form "testSSSS.bat" with an output file
rem   in the form "testSSSS.out"
rem   A test succeeds if it generates the expected output file.
rem   If a test fails, you can rerun with -v to get diff output.
rem   diff is required to run this and must be available in your path
pushd tests

if "%1" == "-v" set verbose=1

set /A numtests= 0
set /A numfails= 0
set /A numpass= 0

for %%t in ("test*.bat") do call :run %%~nt

echo %numtests% tests taken
echo %numpass% tests passed
if %numfails% NEQ 0 echo %numfails% tests failed

goto :end

set /A numtests += 1
call %1.bat > testoutput 2>&1
diff -u %1.out testoutput > diffresults.txt 
for %%R in ("diffresults.txt") do call :checksize %%~zR %1 
erase testoutput
erase diffresults.txt
goto :eof

if "%1" == "0" call :testpassed %2 
if "%1" NEQ "0" call :testfailed %2
goto :eof

echo failed %1
set /A numfails += 1
if "%verbose%" == "1" echo diff output:
if "%verbose%" == "1" type diffresults.txt
goto :eof

echo passed %1
set /A numpass += 1
goto :eof


echo on