Add few test to travis and appveyor. (#2641)

* Add few test to travis and appveyor.
* Update runserver.bat to be more alike athena-start. (nb terminating cmd.bat would be better)
This commit is contained in:
lighta 2017-12-01 14:46:09 -04:00 committed by Aleos
parent f59298adda
commit 53db4358b7
7 changed files with 141 additions and 6 deletions

View File

@ -37,6 +37,8 @@ script:
- ./tools/ci/npc.sh
- make clean
- make server
- ./login-server --run-once
- ./char-server --run-once
- ./map-server --run-once
env:

View File

@ -108,4 +108,8 @@ test_script:
rem Start the map server
login-server.exe --run-once
char-server.exe --run-once
map-server.exe --run-once

View File

@ -1,2 +1,2 @@
@ECHO OFF
CALL serv.bat char-server.exe Char-Server
CALL serv.bat char-server.exe Char-Server %*

View File

@ -1,2 +1,2 @@
@ECHO OFF
CALL serv.bat login-server.exe Login-Server
CALL serv.bat login-server.exe Login-Server %*

View File

@ -1,2 +1,2 @@
@ECHO OFF
CALL serv.bat map-server.exe Map-Server
CALL serv.bat map-server.exe Map-Server %*

View File

@ -3,6 +3,130 @@ rem This is and auto-restart script for the rAthena Ragnarok Online Server Emula
rem It will also keep the map server OPEN after it crashes to that errors may be
rem more easily identified
rem Writen by Jbain
start cmd /k logserv.bat
start cmd /k charserv.bat
start cmd /k mapserv.bat
rem modified by lighta
set SOURCE_DIR=%~dp0
cd %SOURCE_DIR%
if ["%~1"]==[""] (
REM this is for backward compatibility
set "target=watch"
) else set target=%~1
echo "target=%target%"
REM to avoid any localization issue
set "login_running=false"
set "char_running=false"
set "map_running=false"
if "%target%" == "status" (
call :getStatus
) else if "%target%" == "watch" (
call :Watch
) else if "%target%" == "stop" (
call :Stop
) else if "%target%" == "stop" (
call :Stop
) else if "%target%" == "start" (
call :Start
)
goto :EOF
:Stop
echo "Stoping all serv"
call :stopLogin
call :stopChar
call :stopMap
goto :EOF
:Watch
REM this is to align terminology with athena-start, (start with restart mode)
echo "Starting all serv"
set "resart_mode=on"
call :startLogin
call :startChar
call :startMap
goto :EOF
:Start
echo "Starting all serv"
set "resart_mode=off"
call :startLogin
call :startChar
call :startMap
goto :EOF
:getStatus
echo "Getting status of all serv"
call :getLoginStatus
call :getCharStatus
call :getMapStatus
if "%login_running%" == "false" ( echo "login_serv is not running"
) else echo "login_serv is running pid=%LoginServPID%"
if "%char_running%" == "false" ( echo "char_serv is not running"
) else echo "char_serv is running pid=%CharServPID%"
if "%map_running%" == "false" ( echo "map_serv is not running"
) else echo "map_serv is running pid=%MapServPID%"
goto :EOF
REM ====
REM sub targets (a target per serv)
REM ====
REM stop sub targets
:stopLogin
call :getLoginStatus
if "%login_running%" == "true" Taskkill /PID %LoginServPID% /F
goto :EOF
:stopChar
call :getCharStatus
if "%char_running%" == "true" Taskkill /PID %CharServPID% /F
goto :EOF
:stopMap
call :getMapStatus
if "%map_running%" == "true" Taskkill /PID %MapServPID% /F
goto :EOF
REM start sub targets
:startLogin
call :getLoginStatus
if "%login_running%" == "false" ( start cmd /k logserv.bat %resart_mode%
) else echo "Login serv is already running pid=%LoginServPID%"
goto :EOF
:startChar
call :getCharStatus
if "%char_running%" == "false" ( start cmd /k charserv.bat %resart_mode%
) else echo "Char serv is already running, pid=%CharServPID%"
goto :EOF
:startMap
call :getMapStatus
if "%map_running%" == "false" ( start cmd /k mapserv.bat %resart_mode%
) else echo "Map serv is already running, pid=%MapServPID%"
goto :EOF
REM status sub targets
:getLoginStatus
for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq login-server.exe"') do set LoginServPID=%%b
echo(%LoginServPID%|findstr "^[-][1-9][0-9]*$ ^[1-9][0-9]*$ ^0$">nul&& set "login_running=true" || set "login_running=false"
goto :EOF
:getCharStatus
for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq char-server.exe"') do set CharServPID=%%b
echo(%CharServPID%|findstr "^[-][1-9][0-9]*$ ^[1-9][0-9]*$ ^0$">nul&& set "char_running=true" || set "char_running=false"
goto :EOF
:getMapStatus
for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq map-server.exe"') do set MapServPID=%%b
echo(%MapServPID%|findstr "^[-][1-9][0-9]*$ ^[1-9][0-9]*$ ^0$">nul&& set "map_running=true" || set "map_running=false"
goto :EOF

View File

@ -2,6 +2,10 @@
IF "%1"=="" GOTO DIRECT
IF "%2"=="" GOTO DIRECT
IF NOT EXIST "%1" GOTO NOTFOUND
IF "%3"=="" ( set "restart_mode=on"
) else set "restart_mode=%~3"
echo "restart_mode=%restart_mode%"
GOTO START
REM == How RESTART_9X and RESTART_NT works =========================
@ -25,6 +29,7 @@ REM Windows 2000, XP, Vista, 7
REM There is no CHOICE in 2000 and XP, but you get asked whether to
REM abort the batch file, when pressing Ctrl+C in PING.
IF "%1"=="mapcache.exe" GOTO END
if "%restart_mode%" == "off" GOTO END
ECHO Restarting in 15 seconds, press Ctrl+C to cancel.
PING -n 15 127.0.0.1 > NUL