Merge branch 'launch-httpbin'
Fix multiple problems with using "pip install httpbin". Closes https://github.com/wxWidgets/wxWidgets/pull/2303
This commit is contained in:
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@@ -189,13 +189,9 @@ jobs:
|
||||
if: matrix.skip_testing != true
|
||||
working-directory: tests
|
||||
run: |
|
||||
echo "Launching httpbin"
|
||||
# Current decorator (>= 5) is incompatible with Python 2 which we
|
||||
# still use under in some builds, so explicitly use a version which
|
||||
# is known to work.
|
||||
pip install decorator==4.4.2 httpbin
|
||||
python -m httpbin.core 2>&1 >httpbin.log &
|
||||
export WX_TEST_WEBREQUEST_URL=http://localhost:5000
|
||||
. ../build/tools/httpbin.sh
|
||||
|
||||
httpbin_launch
|
||||
|
||||
export ASAN_OPTIONS=fast_unwind_on_malloc=0
|
||||
|
||||
@@ -210,11 +206,9 @@ jobs:
|
||||
./test || rc=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$rc" ]; then
|
||||
echo '*** Tests failed, contents of httpbin.log follows: ***'
|
||||
echo '-----------------------------------------------------------'
|
||||
cat httpbin.log
|
||||
echo '-----------------------------------------------------------'
|
||||
httpbin_show_log
|
||||
exit $rc
|
||||
fi
|
||||
|
||||
|
69
build/tools/httpbin.sh
Normal file
69
build/tools/httpbin.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
# This script is sourced by CI scripts to launch httpbin.
|
||||
#
|
||||
# Do not run it directly.
|
||||
|
||||
httpbin_launch() {
|
||||
echo 'Launching httpbin...'
|
||||
|
||||
case "$(uname -s)" in
|
||||
Linux)
|
||||
dist_codename=$(lsb_release --codename --short)
|
||||
;;
|
||||
|
||||
Darwin)
|
||||
dist_codename='macOS'
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$dist_codename" in
|
||||
trusty)
|
||||
# Current decorator (>= 5) is incompatible with Python 2 which we
|
||||
# still use in some builds, so explicitly use a version which
|
||||
# is known to work. Just specifying "decorator==4.4.2" doesn't work
|
||||
# neither for some reason ("no matching distribution found"), so
|
||||
# use an explicit URL.
|
||||
pip_decorator_arg='https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl'
|
||||
|
||||
# We need to disable SSL certificate checking under Trusty because
|
||||
# Python version there is too old to support SNI.
|
||||
pip_options='--trusted-host files.pythonhosted.org'
|
||||
;;
|
||||
|
||||
macOS)
|
||||
pip_decorator_arg='decorator==4.4.2'
|
||||
;;
|
||||
|
||||
*)
|
||||
# Elsewhere just use Python 3.
|
||||
PY3=3
|
||||
|
||||
# Ensure that we have at least some version of pip.
|
||||
if ! python3 -m pip; then
|
||||
sudo apt-get -q -o=Dpkg::Use-Pty=0 install python3-pip
|
||||
fi
|
||||
|
||||
# Running pip install fails with weird errors out of the box when
|
||||
# using old pip version because it attempts to use python rather
|
||||
# than python3, so upgrade it to fix this.
|
||||
#
|
||||
# However don't upgrade to a version which is too new because then
|
||||
# it may not support Python version that we actually have.
|
||||
python3 -m pip install --user --upgrade pip==20.0.1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Installing using `python$PY3 -m pip --version`"
|
||||
|
||||
python$PY3 -m pip install $pip_decorator_arg httpbin --user $pip_options
|
||||
python$PY3 -m httpbin.core 2>&1 >httpbin.log &
|
||||
WX_TEST_WEBREQUEST_URL="http://localhost:5000"
|
||||
|
||||
export WX_TEST_WEBREQUEST_URL
|
||||
}
|
||||
|
||||
httpbin_show_log() {
|
||||
echo '*** Tests failed, contents of httpbin.log follows: ***'
|
||||
echo '-----------------------------------------------------------'
|
||||
cat httpbin.log
|
||||
echo '-----------------------------------------------------------'
|
||||
}
|
@@ -4,6 +4,8 @@
|
||||
|
||||
set -e
|
||||
|
||||
. ./build/tools/httpbin.sh
|
||||
|
||||
wxPROC_COUNT=`getconf _NPROCESSORS_ONLN`
|
||||
((wxPROC_COUNT++))
|
||||
wxBUILD_ARGS="-j$wxPROC_COUNT"
|
||||
@@ -12,42 +14,6 @@ wxBUILD_ARGS="-j$wxPROC_COUNT"
|
||||
# messages from WebKit tests that we're not interested in.
|
||||
export NO_AT_BRIDGE=1
|
||||
|
||||
launch_httpbin() {
|
||||
echo 'travis_fold:start:httpbin'
|
||||
echo 'Running httpbin...'
|
||||
|
||||
case "$(uname -s)" in
|
||||
Linux)
|
||||
dist_codename=$(lsb_release --codename --short)
|
||||
;;
|
||||
esac
|
||||
|
||||
# We need to disable SSL certificate checking under Trusty because Python
|
||||
# version there is too old to support SNI.
|
||||
case "$dist_codename" in
|
||||
trusty)
|
||||
# Here "decorator==4.4.2" doesn't work neither for some reason ("no
|
||||
# matching distribution found"), so use an explicit URL.
|
||||
pip_decorator_arg='https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl'
|
||||
pip_options='--trusted-host files.pythonhosted.org'
|
||||
;;
|
||||
|
||||
*)
|
||||
# Current decorator (>= 5) is incompatible with Python 2 which we
|
||||
# still use under in some builds, so explicitly use a version which
|
||||
# is known to work.
|
||||
pip_decorator_arg='decorator==4.4.2'
|
||||
;;
|
||||
esac
|
||||
|
||||
pip install $pip_decorator_arg httpbin --user $pip_options
|
||||
python -m httpbin.core &
|
||||
WX_TEST_WEBREQUEST_URL="http://localhost:5000"
|
||||
|
||||
export WX_TEST_WEBREQUEST_URL
|
||||
echo 'travis_fold:end:httpbin'
|
||||
}
|
||||
|
||||
case $wxTOOLSET in
|
||||
cmake)
|
||||
if [ -z $wxCMAKE_TESTS ]; then wxCMAKE_TESTS=CONSOLE_ONLY; fi
|
||||
@@ -78,12 +44,18 @@ case $wxTOOLSET in
|
||||
echo 'travis_fold:end:install'
|
||||
|
||||
if [ "$wxCMAKE_TESTS" != "OFF" ]; then
|
||||
launch_httpbin
|
||||
echo 'travis_fold:start:httpbin'
|
||||
httpbin_launch
|
||||
echo 'travis_fold:end:httpbin'
|
||||
|
||||
echo 'travis_fold:start:testing'
|
||||
echo 'Testing...'
|
||||
ctest -V -C Debug -E "test_drawing" --output-on-failure --interactive-debug-mode 0 .
|
||||
ctest -V -C Debug -E "test_drawing" --output-on-failure --interactive-debug-mode 0 . || rc=$?
|
||||
echo 'travis_fold:end:testing'
|
||||
if [ -n "$rc" ]; then
|
||||
httpbin_show_log
|
||||
exit $rc
|
||||
fi
|
||||
fi
|
||||
|
||||
echo 'travis_fold:start:testinstall'
|
||||
@@ -162,14 +134,20 @@ case $wxTOOLSET in
|
||||
exit 0
|
||||
fi
|
||||
|
||||
launch_httpbin
|
||||
echo 'travis_fold:start:httpbin'
|
||||
httpbin_launch
|
||||
echo 'travis_fold:end:httpbin'
|
||||
|
||||
echo 'travis_fold:start:testing'
|
||||
echo 'Testing...'
|
||||
pushd tests
|
||||
./test
|
||||
./test || rc=$?
|
||||
popd
|
||||
echo 'travis_fold:end:testing'
|
||||
if [ -n "$rc" ]; then
|
||||
httpbin_show_log
|
||||
exit $rc
|
||||
fi
|
||||
|
||||
if [ "$wxSKIP_GUI" = 1 ]; then
|
||||
echo 'Skipping the rest of tests for non-GUI build.'
|
||||
|
Reference in New Issue
Block a user