test-all.bat 3.1 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
    echo Windows Taosd Full Test
    set /a exitNum=0
8
    del /Q /F failed.txt
wafwerar's avatar
wafwerar 已提交
9
    set caseFile="fulltest.sh"
10 11 12 13
    if not "%2" == "" (
        set caseFile="%2"
    )
    for /F "usebackq tokens=*" %%i in (!caseFile!) do (
wafwerar's avatar
wafwerar 已提交
14 15 16 17 18 19 20 21 22
        call :CheckSkipCase %%i
        if !skipCase! == false (
            set line=%%i
            if "!line:~,7!" == "python3" (
                set /a a+=1
                echo !a! Processing %%i
                call :GetTimeSeconds !time!
                set time1=!_timeTemp!
                echo Start at !time!
wafwerar's avatar
wafwerar 已提交
23
                call %%i ARG1 > result_!a!.txt 2>error_!a!.txt || set errorlevel=8
wafwerar's avatar
wafwerar 已提交
24 25
                if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && set /a exitNum=8 && echo %%i >>failed.txt ) else ( call :colorEcho 0a "Success" &echo. )
            )
wafwerar's avatar
wafwerar 已提交
26 27
        )
    )
wafwerar's avatar
wafwerar 已提交
28
    exit /b !exitNum!
wafwerar's avatar
wafwerar 已提交
29
)
wafwerar's avatar
wafwerar 已提交
30
echo Windows Taosd Test
wafwerar's avatar
wafwerar 已提交
31
for /F "usebackq tokens=*" %%i in (simpletest.bat) do (
32 33
    for /f "tokens=1* delims= " %%a in ("%%i") do if not "%%a" == "@REM" (
        set /a a+=1
wafwerar's avatar
wafwerar 已提交
34
        set timeNow=!time!
wafwerar's avatar
wafwerar 已提交
35
        echo !a! Processing %%i
wafwerar's avatar
wafwerar 已提交
36
        call :GetTimeSeconds !timeNow!
wafwerar's avatar
wafwerar 已提交
37
        set time1=!_timeTemp!
wafwerar's avatar
wafwerar 已提交
38
        echo Start at !timeNow!
wafwerar's avatar
wafwerar 已提交
39 40
        call %%i ARG1 > result_!a!.txt 2>error_!a!.txt || set errorlevel=8
        if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit /b 8 ) else ( call :colorEcho 0a "Success" &echo. ) 
41
    )
wafwerar's avatar
wafwerar 已提交
42
)
wafwerar's avatar
wafwerar 已提交
43
@REM echo Linux Taosd Test
wafwerar's avatar
wafwerar 已提交
44
@REM for /F "usebackq tokens=*" %%i in (simpletest.bat) do (
wafwerar's avatar
wafwerar 已提交
45 46
@REM     for /f "tokens=1* delims= " %%a in ("%%i") do if not "%%a" == "@REM" (
@REM         set /a a+=1
wafwerar's avatar
wafwerar 已提交
47 48 49 50
@REM         echo !a! Processing %%i
@REM         call :GetTimeSeconds !time!
@REM         set time1=!_timeTemp!
@REM         echo Start at !time!
wafwerar's avatar
wafwerar 已提交
51 52 53 54
@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 已提交
55
exit /b
wafwerar's avatar
wafwerar 已提交
56 57

:colorEcho
wafwerar's avatar
wafwerar 已提交
58 59
set timeNow=%time%
call :GetTimeSeconds %timeNow%
wafwerar's avatar
wafwerar 已提交
60 61
set time2=%_timeTemp%
set /a interTime=%time2% - %time1%
wafwerar's avatar
wafwerar 已提交
62
echo End at %timeNow% , cast %interTime%s
wafwerar's avatar
wafwerar 已提交
63 64 65
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
wafwerar's avatar
wafwerar 已提交
66 67 68 69 70 71 72
del "%~2" > nul 2>&1i
goto :eof

:GetTimeSeconds
set tt=%1
set tt=%tt:.= %
set tt=%tt::= %
wafwerar's avatar
wafwerar 已提交
73
set tt=%tt: 0= %
wafwerar's avatar
wafwerar 已提交
74
set /a index=1
wafwerar's avatar
wafwerar 已提交
75 76
for %%a in (%tt%) do (
    if !index! EQU 1 (
wafwerar's avatar
wafwerar 已提交
77
        set /a hh=%%a
wafwerar's avatar
wafwerar 已提交
78 79
    )^
    else if  !index! EQU 2 (
wafwerar's avatar
wafwerar 已提交
80
        set /a mm=%%a
wafwerar's avatar
wafwerar 已提交
81 82 83
 
    )^
    else if  !index! EQU 3 (
wafwerar's avatar
wafwerar 已提交
84
        set /a ss=%%a
wafwerar's avatar
wafwerar 已提交
85 86 87
    )
   set /a index=index+1
)
wafwerar's avatar
wafwerar 已提交
88
set /a _timeTemp=(%hh%*60+%mm%)*60+%ss%
89
goto :eof
wafwerar's avatar
wafwerar 已提交
90 91 92

:CheckSkipCase
set skipCase=false
haoranc's avatar
haoranc 已提交
93 94
if "%*" == "python3 ./test.py -f 1-insert/insertWithMoreVgroup.py" ( set skipCase=false )
if "%*" == "python3 ./test.py -f 2-query/queryQnode.py" ( set skipCase=false )
95
echo %* | grep "\-R" && set skipCase=true
wafwerar's avatar
wafwerar 已提交
96
:goto eof