Skip to content

Commit f352922

Browse files
committed
增加测试命令
1 parent 44aa322 commit f352922

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

src/test/bin/ipfs.starter.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo on
2+
start cmd.exe /c "ipfs daemon --enable-pubsub-experiment"
3+
cls
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@echo off
2+
set currentPath=%cd%
3+
set "ts=%time: =0%"
4+
set beginTime=%date:~0,4%-%date:~5,2%-%date:~8,2% %ts:~0,2%:%ts:~3,2%:%ts:~6,2%
5+
set logDate=%date:~0,4%-%date:~5,2%-%date:~8,2%
6+
set logTime=%ts:~0,2%%ts:~3,2%
7+
set logfile=%currentPath%\%logDate%.%logTime%.ipfs.log
8+
set INTERVAL=6
9+
rem 运行约20分钟
10+
set maxTime=5
11+
set num=0
12+
@echo off
13+
echo %logfile%
14+
echo ------------------- BEGIN : %beginTime% ----------------------------------- >> %logfile%
15+
echo GOPATH: %GOPATH% >> %logfile%
16+
echo "每隔 %INTERVAL% 秒检测 swarm peers" >> %logfile%
17+
echo "当前 IPFS Node: " >> %logfile%
18+
call ipfs id >> %logfile%
19+
set params=%logfile%
20+
echo "IPFS Starting........" >> %logfile%
21+
echo 启动时间 : %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2% %time% >> %logfile%
22+
call ipfs.starter.bat
23+
echo "IPFS START Success." >> %logfile%
24+
@ping -n 10 127.1 >nul
25+
echo ************************************************************************************** >> %logfile%
26+
27+
@echo off
28+
goto swarmpeers
29+
pause
30+
31+
rem 启动监测
32+
:swarmpeers
33+
set /a num+=1
34+
35+
echo ****** The %num% Times ******
36+
echo --------%num% [ %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2% %time% ] --------------------------- >> %logfile%
37+
@echo off
38+
ipfs swarm peers >> %logfile%
39+
@echo off
40+
if %num% equ %maxTime% goto shutdown
41+
@ping -n %INTERVAL% 127.1 >nul
42+
goto swarmpeers
43+
44+
rem shutdown
45+
:shutdown
46+
ipfs shutdown
47+
exit
48+

0 commit comments

Comments
 (0)