mirror of
https://github.com/rizinorg/rizin.git
synced 2026-10-11 22:19:51 +00:00
Run http test on Windows (#6839)
* Run http test on Windows * Install `psutil` whenever `requests` is installed * Use `psutil` 6.1.1 on CentOS 7 * Install `python3-devel` on CentOS 7 * Install `py3-psutil` on Alpine * Use `Python314-x64` in `clang_cl_64_dyn` build
This commit is contained in:
+3
-2
@@ -35,7 +35,7 @@ environment:
|
||||
TEST_INCLUDE_HEADERS_CPP: false
|
||||
# Clang-cl 64 (Dynamic linking)
|
||||
- builder: clang_cl_64_dyn
|
||||
PYTHON: 'C:\\Python314'
|
||||
PYTHON: 'C:\\Python314-x64'
|
||||
INNO_SETUP: 'C:\\Program Files (x86)\\Inno Setup 6'
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2026
|
||||
RUN_TESTS: true
|
||||
@@ -98,13 +98,14 @@ for:
|
||||
# Windows Python ships no python3.exe, so `python3` spawned by the tests would
|
||||
# resolve to another interpreter on PATH that has no rzpipe installed
|
||||
- copy /y "%PYTHON%\python.exe" "%PYTHON%\python3.exe"
|
||||
- copy /y "%PYTHON%\pythonw.exe" "%PYTHON%\pythonw3.exe"
|
||||
- set PATH=%APPVEYOR_BUILD_FOLDER%\%DIST_FOLDER%\bin;%PYTHON%;C:\msys64\mingw64\bin;%PATH%
|
||||
- echo %PATH%
|
||||
- where rizin
|
||||
- where python3
|
||||
- rizin -v
|
||||
- '%PYTHON%\\python -m pip install "git+https://github.com/rizinorg/rz-pipe#egg=rzpipe&subdirectory=python"'
|
||||
- "%PYTHON%\\python -m pip install requests"
|
||||
- "%PYTHON%\\python -m pip install psutil requests"
|
||||
- cd test
|
||||
- git clone -q --depth 1 -c core.symlinks=true https://github.com/rizinorg/rizin-testbins bins
|
||||
- cd ..
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
test/www/simple.html text eol=lf
|
||||
subprojects/rizin-shell-parser/src/grammar.json linguist-generated=true
|
||||
subprojects/rizin-shell-parser/src/node-types.json linguist-generated=true
|
||||
subprojects/rizin-shell-parser/src/parser.c linguist-generated=true
|
||||
|
||||
@@ -373,10 +373,10 @@ jobs:
|
||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
|
||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
|
||||
- name: Install tools
|
||||
run: yum install -y patch unzip git gcc make python3-pip
|
||||
run: yum install -y patch unzip git gcc make python3-pip python3-devel
|
||||
# Pin Meson to the last version stil supporting Python 3.6
|
||||
- name: Install meson and ninja
|
||||
run: pip3 install meson==0.61.5 ninja PyYAML requests
|
||||
run: pip3 install meson==0.61.5 ninja PyYAML psutil==6.1.1 requests
|
||||
- name: Checkout rizin
|
||||
run: |
|
||||
git clone https://github.com/${{ github.repository }}
|
||||
@@ -481,7 +481,7 @@ jobs:
|
||||
env:
|
||||
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig
|
||||
- name: Install test dependencies
|
||||
run: python3 -m pip install --user 'git+https://github.com/rizinorg/rz-pipe#egg=rzpipe&subdirectory=python' requests
|
||||
run: python3 -m pip install --user 'git+https://github.com/rizinorg/rz-pipe#egg=rzpipe&subdirectory=python' psutil requests
|
||||
- name: Run tests
|
||||
# Debug tests fail on old Debian because of the runtime differences, ignore them
|
||||
run: |
|
||||
@@ -499,7 +499,7 @@ jobs:
|
||||
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: apk add --no-cache git gcc g++ linux-headers cmake curl wget unzip py3-wheel py3-setuptools py3-pip meson ninja xz py3-requests
|
||||
run: apk add --no-cache git gcc g++ linux-headers cmake curl wget unzip py3-wheel py3-setuptools py3-pip meson ninja xz py3-psutil py3-requests
|
||||
- name: Checkout rizin
|
||||
run: |
|
||||
git clone https://github.com/${{ github.repository }}
|
||||
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
path: test/rz-pipe
|
||||
|
||||
- name: Install test dependencies
|
||||
run: pip3 install --user "file://$GITHUB_WORKSPACE/test/rz-pipe#egg=rzpipe&subdirectory=python" requests
|
||||
run: pip3 install --user "file://$GITHUB_WORKSPACE/test/rz-pipe#egg=rzpipe&subdirectory=python" psutil requests
|
||||
env:
|
||||
PIP_BREAK_SYSTEM_PACKAGES: 1
|
||||
|
||||
|
||||
@@ -8,11 +8,17 @@ a new connection.
|
||||
|
||||
import http.client
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
args = "-m http.server 9000 --bind 127.0.0.1"
|
||||
if sys.platform == "win32":
|
||||
cmd = "start /B pythonw3 " + args
|
||||
else:
|
||||
cmd = "python3 " + args + " &"
|
||||
subprocess.run(
|
||||
"python3 -m http.server 9000 --bind 127.0.0.1 &",
|
||||
cmd,
|
||||
shell=True,
|
||||
check=True,
|
||||
cwd="www",
|
||||
|
||||
@@ -9,14 +9,22 @@ import re
|
||||
import sys
|
||||
import psutil
|
||||
|
||||
http_server_killed = 0
|
||||
for p in psutil.process_iter(["cmdline"]):
|
||||
try:
|
||||
if re.search(r"[Pp]ython3? -m http\.server", " ".join(p.cmdline())):
|
||||
if re.search(r"[Pp]ythonw?3? -m http\.server 9000", " ".join(p.cmdline())):
|
||||
p.kill()
|
||||
print("Killed http.server")
|
||||
sys.exit(0)
|
||||
http_server_killed += 1
|
||||
if http_server_killed == 2:
|
||||
# Not stopping at 1 since what got killed might have been the
|
||||
# shell that ran the server
|
||||
break
|
||||
except (psutil.AccessDenied, psutil.NoSuchProcess):
|
||||
pass
|
||||
|
||||
print("ERROR: http.server process not found")
|
||||
sys.exit(1)
|
||||
if http_server_killed > 0:
|
||||
print("Killed http.server")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print("ERROR: http.server process not found")
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user