test-all.bat 2.5 KB
Newer Older
wafwerar's avatar
wafwerar 已提交
1 2 3 4
@echo off
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do     rem"') do (  set "DEL=%%a")
set /a a=0
wafwerar's avatar
wafwerar 已提交
5
if %1 == full (
wafwerar's avatar
wafwerar 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18
    echo Windows Taosd Full Test
    set /a exitNum=0
    for /F "usebackq tokens=*" %%i in (fulltest.bat) do (
        for /f "tokens=1* delims= " %%a in ("%%i") do if not "%%a" == "@REM" (
            set /a a+=1
            echo !a! Processing %%i
            call :GetTimeSeconds !time!
            set time1=!_timeTemp!
            echo Start at !time!
            call %%i ARG1 > result_!a!.txt 2>error_!a!.txt
            if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && set /a exitNum=8 ) else ( call :colorEcho 0a "Success" &echo. ) 
        )
    )
wafwerar's avatar
wafwerar 已提交
19
    exit !exitNum!
wafwerar's avatar
wafwerar 已提交
20
)
wafwerar's avatar
wafwerar 已提交
21
echo Windows Taosd Test
wafwerar's avatar
wafwerar 已提交
22
for /F "usebackq tokens=*" %%i in (simpletest.bat) do (
23 24
    for /f "tokens=1* delims= " %%a in ("%%i") do if not "%%a" == "@REM" (
        set /a a+=1
wafwerar's avatar
wafwerar 已提交
25 26 27 28
        echo !a! Processing %%i
        call :GetTimeSeconds !time!
        set time1=!_timeTemp!
        echo Start at !time!
wafwerar's avatar
wafwerar 已提交
29
        call %%i ARG1 > result_!a!.txt 2>error_!a!.txt
30 31
        if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit 8 ) else ( call :colorEcho 0a "Success" &echo. ) 
    )
wafwerar's avatar
wafwerar 已提交
32
)
wafwerar's avatar
wafwerar 已提交
33
@REM echo Linux Taosd Test
wafwerar's avatar
wafwerar 已提交
34
@REM for /F "usebackq tokens=*" %%i in (simpletest.bat) do (
wafwerar's avatar
wafwerar 已提交
35 36
@REM     for /f "tokens=1* delims= " %%a in ("%%i") do if not "%%a" == "@REM" (
@REM         set /a a+=1
wafwerar's avatar
wafwerar 已提交
37 38 39 40
@REM         echo !a! Processing %%i
@REM         call :GetTimeSeconds !time!
@REM         set time1=!_timeTemp!
@REM         echo Start at !time!
wafwerar's avatar
wafwerar 已提交
41 42 43 44
@REM         call %%i ARG1 -m %1 > result_!a!.txt 2>error_!a!.txt
@REM         if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit 8 ) else ( call :colorEcho 0a "Success" &echo. ) 
@REM     )
@REM )
wafwerar's avatar
wafwerar 已提交
45 46 47
exit

:colorEcho
wafwerar's avatar
wafwerar 已提交
48 49 50 51
call :GetTimeSeconds %time%
set time2=%_timeTemp%
set /a interTime=%time2% - %time1%
echo End at %time% , cast %interTime%s
wafwerar's avatar
wafwerar 已提交
52 53 54
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
wafwerar's avatar
wafwerar 已提交
55 56 57 58 59 60 61 62 63 64
del "%~2" > nul 2>&1i
goto :eof

:GetTimeSeconds
set tt=%1
set tt=%tt:.= %
set tt=%tt::= %
set index=1
for %%a in (%tt%) do (
    if !index! EQU 1 (
wafwerar's avatar
wafwerar 已提交
65
        set /a hh=%%a
wafwerar's avatar
wafwerar 已提交
66 67
    )^
    else if  !index! EQU 2 (
wafwerar's avatar
wafwerar 已提交
68
        set /a mm=%%a
wafwerar's avatar
wafwerar 已提交
69 70 71
 
    )^
    else if  !index! EQU 3 (
wafwerar's avatar
wafwerar 已提交
72
        set /a ss=%%a
wafwerar's avatar
wafwerar 已提交
73 74 75
    )
   set /a index=index+1
)
wafwerar's avatar
wafwerar 已提交
76
set /a _timeTemp=(%hh%*60+%mm%)*60+%ss%  || echo hh:%hh% mm:%mm% ss:%ss%
wafwerar's avatar
wafwerar 已提交
77
goto :eof