mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 17:02:51 +08:00
Use go-httpbin instead of python httpbin for the tests
Python version is too fragile and gets constantly broken by the changes in Python ecosystem, so switch to the hopefully more stable Go version. Closes #23398.
This commit is contained in:
committed by
Vadim Zeitlin
parent
8e0c9512ab
commit
abaeec23bf
+11
-11
@@ -166,15 +166,9 @@ jobs:
|
||||
|
||||
# Explanation for installing some less obvious packages:
|
||||
# - coreutils contains nproc used in proc_count.sh called below.
|
||||
# - Python can't be installed using the action as usual because
|
||||
# it installs an ABI-incompatible version, see (wrongly, IMO)
|
||||
# closed https://github.com/actions/setup-python/issues/370
|
||||
# - And python3-cffi can't be installed by pip because it can't
|
||||
# be built from source with gcc 4.8 any longer (its build
|
||||
# script uses -Wdate-time option unknown to this compiler).
|
||||
# - xvfb is used for running the GUI tests.
|
||||
apt-get update -qq
|
||||
apt-get install -qq coreutils ${compiler-g++} git make pkg-config python3 python3-cffi python3-pip sudo xvfb
|
||||
apt-get install -qq coreutils ${compiler-g++} git make pkg-config sudo xvfb
|
||||
;;
|
||||
|
||||
'')
|
||||
@@ -324,11 +318,17 @@ jobs:
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_tests }}
|
||||
|
||||
- name: Setup Python
|
||||
if: matrix.container == ''
|
||||
uses: actions/setup-python@v5
|
||||
- name: Setup Go
|
||||
if: matrix.container != 'ubuntu:18.04'
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
go-version: '1'
|
||||
|
||||
- name: Setup Go Ubuntu 18.04
|
||||
if: matrix.container == 'ubuntu:18.04'
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1'
|
||||
|
||||
- name: Testing
|
||||
working-directory: tests
|
||||
|
||||
@@ -150,10 +150,11 @@ jobs:
|
||||
cmake --build . --target install
|
||||
fi
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
- name: Setup Go
|
||||
if: matrix.cmake_tests != 'OFF'
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
go-version: '1'
|
||||
|
||||
- name: Testing
|
||||
if: matrix.cmake_tests != 'OFF'
|
||||
|
||||
@@ -201,12 +201,11 @@ jobs:
|
||||
make -C tests $wxBUILD_ARGS failtest
|
||||
make -k -C tests $wxBUILD_ARGS "CXXFLAGS=$wxMAKEFILE_CXXFLAGS" "LDFLAGS=$wxMAKEFILE_LDFLAGS"
|
||||
|
||||
- name: Setup Python
|
||||
# actions/setup-python broken on self-hosted https://github.com/actions/setup-python/issues/108
|
||||
if: matrix.runner != 'self-hosted'
|
||||
uses: actions/setup-python@v5
|
||||
- name: Setup Go
|
||||
if: matrix.skip_testing != true
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
go-version: '1'
|
||||
|
||||
- name: Testing
|
||||
if: matrix.skip_testing != true
|
||||
|
||||
+14
-6
@@ -29,6 +29,8 @@ skip_commits:
|
||||
- build/tools/httpbin.sh
|
||||
|
||||
environment:
|
||||
GOVERSION: "1.22.1"
|
||||
GOPATH: c:\gopath
|
||||
matrix:
|
||||
- TOOLSET: msbuild
|
||||
CONFIGURATION: DLL Release
|
||||
@@ -83,15 +85,21 @@ before_build:
|
||||
build_script: c:\projects\wxwidgets\build\tools\appveyor.bat
|
||||
|
||||
before_test:
|
||||
- cmd: |
|
||||
echo Getting and launching httpbin.
|
||||
rmdir %GOROOT% /s /q
|
||||
mkdir %GOROOT%
|
||||
appveyor DownloadFile https://go.dev/dl/go%GOVERSION%.windows-amd64.msi
|
||||
msiexec /i go%GOVERSION%.windows-amd64.msi INSTALLDIR="%GOROOT%" /q
|
||||
go version
|
||||
go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin@v2
|
||||
set PATH=%PATH%;%GOPATH%\bin
|
||||
- ps: |
|
||||
Write-Output "Getting and launching httpbin."
|
||||
$env:PATH = "C:\Python38;C:\Python38\Scripts;" + $env:PATH
|
||||
pip.exe --disable-pip-version-check install Flask==2.0.3 Werkzeug==2.0.3 httpbin
|
||||
Start-Job -Name wx_httpbin { python.exe -m httpbin.core 2>&1 > c:\projects\wxwidgets\httpbin.log }
|
||||
Start-Job -Name wx_httpbin { go-httpbin -host 127.0.0.1 -port 8081 2>&1 > c:\projects\wxwidgets\httpbin.log }
|
||||
Start-Sleep -Seconds 5
|
||||
curl.exe --silent --show-error http://127.0.0.1:5000/ip > $null
|
||||
curl.exe --silent --show-error http://127.0.0.1:8081/ip > $null
|
||||
if ($lastExitCode -eq "0") {
|
||||
$env:WX_TEST_WEBREQUEST_URL="http://127.0.0.1:5000"
|
||||
$env:WX_TEST_WEBREQUEST_URL="http://127.0.0.1:8081"
|
||||
}
|
||||
else {
|
||||
Write-Error "Disabling wxWebRequest tests as launching httpbin failed, log follows:"
|
||||
|
||||
@@ -6,16 +6,12 @@ httpbin_launch() {
|
||||
WX_TEST_WEBREQUEST_URL=0
|
||||
export WX_TEST_WEBREQUEST_URL
|
||||
|
||||
go version
|
||||
go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin@v2
|
||||
|
||||
echo 'Launching httpbin...'
|
||||
|
||||
# Installing Flask 2.1.0 and its dependency Werkzeug 2.1.0 results
|
||||
# in failures when trying to run httpbin, so stick to an older but
|
||||
# working version.
|
||||
pip_explicit_deps='Flask==2.0.3 Werkzeug==2.0.3'
|
||||
|
||||
python3 -m pip install $pip_explicit_deps 'httpbin==0.7.0' --user
|
||||
python3 -m httpbin.core --port 50500 2>&1 >httpbin.log &
|
||||
WX_TEST_WEBREQUEST_URL="http://localhost:50500"
|
||||
go-httpbin -host 127.0.0.1 -port 8081 2>&1 >httpbin.log &
|
||||
WX_TEST_WEBREQUEST_URL="http://127.0.0.1:8081"
|
||||
}
|
||||
|
||||
httpbin_show_log() {
|
||||
|
||||
@@ -264,7 +264,8 @@ TEST_CASE_METHOD(RequestFixture,
|
||||
pos += strlen(expectedKey);
|
||||
|
||||
// There may, or not, be a space after it.
|
||||
while ( wxIsspace(response[pos]) )
|
||||
// And the value may be returned in an array.
|
||||
while ( wxIsspace(response[pos]) || response[pos] == '[' )
|
||||
pos++;
|
||||
|
||||
const char* expectedValue = "\"3.14159265358979323\"";
|
||||
|
||||
Reference in New Issue
Block a user