@ECHO OFF
SETLOCAL

SET PROG=%1
SET DELDIR=%2

IF NOT EXIST testOut\ mkdir testOut

@ECHO ON
CALL tclsh poTcllib_FileType.tcl > testOut\_poTcllib_FileType.log

@ECHO ON
CALL tclsh poTcllib_Compress.tcl auto > testOut\_poTcllib_Compress.log

@ECHO ON
CALL tclsh poTklib_ExtProg.tcl 0 auto > testOut\_poTklib_ExtProg_Text.log

@ECHO ON
CALL tclsh poTklib_ExtProg.tcl 1 auto > testOut\_poTklib_ExtProg_RText.log

@ECHO ON
CALL tclsh poTklib_PhotoUtil.tcl testIn\RayTraceLinux\Teapot.tga auto > testOut\_poTklib_PhotoUtil.log

@ECHO ON
CALL tclsh poTklib_Tig.tcl auto > testOut\_poTklib_Tig.log

@ECHO ON
CALL Bitmap_Convert.bat  %PROG% > testOut\_Bitmap_Convert.log

@ECHO ON
CALL Dirdiff_Diff.bat    %PROG% > testOut\_Dirdiff_Diff.log
@ECHO ON
CALL Dirdiff_Search.bat  %PROG% > testOut\_Dirdiff_Search.log
@ECHO ON
CALL Dirdiff_Sync.bat    %PROG% > testOut\_Dirdiff_Sync.log

@ECHO ON
CALL Filediff.bat        %PROG% > testOut\_Filediff.log

@ECHO ON
CALL Imgview_Convert.bat %PROG% > testOut\_Imgview_Convert.log
@ECHO ON
CALL Imgview_Info.bat    %PROG% > testOut\_Imgview_Info.log
@ECHO ON
CALL Imgview_Multi.bat   %PROG% > testOut\_Imgview_Multi.log
@ECHO ON
CALL Imgview_Palette.bat %PROG% > testOut\_Imgview_Palette.log
@ECHO ON
CALL Imgview_Read.bat    %PROG% > testOut\_Imgview_Read.log
@ECHO ON
CALL Imgview_Single.bat  %PROG% > testOut\_Imgview_Single.log

@ECHO ON
CALL Imgdiff_Simple.bat  %PROG% > testOut\_Imgdiff_Simple.log
@ECHO ON
CALL Imgdiff_Large.bat   %PROG% > testOut\_Imgdiff_Large.log

@ECHO ON
CALL Main_Compress.bat   %PROG% > testOut\_Main_Compress.log

@ECHO ON
CALL Office_Misc.bat     %PROG% > testOut\_Office_Misc.log
@ECHO ON
CALL Office_Word.bat     %PROG% > testOut\_Office_Word.log

@ECHO ON
CALL Pres_Video.bat      %PROG% > testOut\_Pres_Video.log

@ECHO ON
CALL SlideShow.bat       %PROG% > testOut\_SlideShow.log

@ECHO OFF
grep "ErrorCode" testOut\*.log
IF NOT "%ERRORLEVEL%"=="1" ECHO ">>> Errors found"

grep "Skipping test" testOut\*.log
IF NOT "%ERRORLEVEL%"=="1" ECHO ">>> Skipped tests found"

IF NOT "X%DELDIR%" == "X" GOTO END
ECHO Removing output directory testOut
RMDIR /S /Q testOut

:END
