Skip to content

Commit 7265f57

Browse files
committed
use bat instead of ps1
1 parent f739e9d commit 7265f57

3 files changed

Lines changed: 48 additions & 48 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@echo off
2+
setlocal
3+
4+
set "PHP_BUILD_DIR=%~1"
5+
if "%PHP_BUILD_DIR%"=="" (
6+
echo Usage: %~nx0 PHP_BUILD_DIR
7+
exit /b 1
8+
)
9+
10+
set "PHP_EXE=%PHP_BUILD_DIR%\php.exe"
11+
set "PHP_SNMP_DLL=%PHP_BUILD_DIR%\php_snmp.dll"
12+
set "PHP_CODE=snmp_set_valueretrieval(SNMP_VALUE_PLAIN); $oid='.1.3.6.1.2.1.1.1.0'; if (@snmpget('127.0.0.1', 'public', $oid, 1000000, 0) === false) exit(1); if (@snmp3_get('127.0.0.1', 'adminMD5AES', 'authPriv', 'MD5', 'test1234', 'AES', 'test1234', $oid, 1000000, 0) === false) exit(1);"
13+
14+
if not exist "%PHP_EXE%" (
15+
echo Could not find "%PHP_EXE%"
16+
exit /b 1
17+
)
18+
19+
if not exist "%PHP_SNMP_DLL%" (
20+
echo Could not find "%PHP_SNMP_DLL%"
21+
exit /b 1
22+
)
23+
24+
for /l %%i in (1,1,30) do (
25+
call :probe
26+
if not errorlevel 1 goto ready
27+
tasklist /fi "IMAGENAME eq snmpd.exe" | findstr /i "snmpd.exe" >nul
28+
if errorlevel 1 (
29+
echo snmpd exited before the readiness check succeeded
30+
goto fail
31+
)
32+
timeout /t 1 /nobreak >nul
33+
)
34+
35+
echo snmpd did not become ready within 30 seconds
36+
goto fail
37+
38+
:ready
39+
exit /b 0
40+
41+
:fail
42+
exit /b 1
43+
44+
:probe
45+
"%PHP_EXE%" -n -dextension_dir=%PHP_BUILD_DIR% -dextension=php_snmp.dll -r "%PHP_CODE%" >nul 2>&1
46+
exit /b %errorlevel%

.github/scripts/windows/check-snmp-ready.ps1

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/scripts/windows/test_task.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ popd
109109
rem prepare for snmp
110110
set MIBDIRS=%DEPS_DIR%\share\mibs
111111
sed -i "s/exec HexTest .*/exec HexTest cscript\.exe \/nologo %GITHUB_WORKSPACE:\=\/%\/ext\/snmp\/tests\/bigtest\.js/g" %GITHUB_WORKSPACE%\ext\snmp\tests\snmpd.conf
112-
powershell -NoProfile -Command "Start-Process -FilePath (Join-Path $env:DEPS_DIR 'bin\snmpd.exe') -ArgumentList '-C','-c',(Join-Path $env:GITHUB_WORKSPACE 'ext\snmp\tests\snmpd.conf'),'-Ln'"
112+
start "" /b "%DEPS_DIR%\bin\snmpd.exe" -C -c "%GITHUB_WORKSPACE%\ext\snmp\tests\snmpd.conf" -Ln
113113
if %errorlevel% neq 0 exit /b 3
114114

115115
set PHP_BUILD_DIR=%PHP_BUILD_OBJ_DIR%\Release
@@ -149,7 +149,7 @@ copy /-y %DEPS_DIR%\bin\*.dll %PHP_BUILD_DIR%\*
149149
if "%ASAN%" equ "1" set ASAN_OPTS=--asan
150150

151151
rem wait until snmpd is fully ready to serve v2c and v3/authPriv requests
152-
powershell -NoProfile -File .github\scripts\windows\check-snmp-ready.ps1 -PhpBuildDir %PHP_BUILD_DIR%
152+
.github\scripts\windows\check-snmp-ready.bat %PHP_BUILD_DIR%
153153
if %errorlevel% neq 0 exit /b 3
154154

155155
mkdir c:\tests_tmp

0 commit comments

Comments
 (0)