Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
jan2000 committed Aug 20, 2024
1 parent ae2c753 commit 4f04acf
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 108 deletions.
204 changes: 109 additions & 95 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
branches:
- master
- '*/ci'
- '*/ci-pytest'
paths-ignore:
- '**/*.md'
- '.azure-pipelines.yml'
Expand Down Expand Up @@ -68,83 +69,84 @@ jobs:
fail-fast: false
matrix:
include:
- name: '!ssl !debug'
compiler: clang
configure: --without-ssl --enable-websockets
macos-version-min: '10.9'
- name: '!ssl !debug'
compiler: gcc-12
configure: --without-ssl --enable-websockets
macos-version-min: '10.9'
- name: '!ssl'
compiler: clang
configure: --enable-debug --without-ssl --enable-websockets
macos-version-min: '10.9'
- name: '!ssl libssh2 AppleIDN'
compiler: clang
configure: --enable-debug --with-libssh2=$(brew --prefix libssh2) --without-ssl --with-apple-idn --enable-websockets
macos-version-min: '10.9'
- name: 'OpenSSL libssh c-ares'
compiler: clang
install: libssh
configure: --enable-debug --with-libssh --with-openssl=$(brew --prefix openssl) --enable-ares --enable-websockets
macos-version-min: '10.9'
- name: 'OpenSSL libssh'
compiler: llvm@15
install: libssh
configure: --enable-debug --with-libssh --with-openssl=$(brew --prefix openssl) --enable-websockets
macos-version-min: '10.9'
- name: '!ssl c-ares'
compiler: clang
configure: --enable-debug --enable-ares --without-ssl --enable-websockets
macos-version-min: '10.9'
- name: '!ssl HTTP-only'
compiler: clang
configure: |
--enable-debug \
--disable-alt-svc --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap \
--disable-ldap --disable-pop3 --disable-rtmp --disable-rtsp --disable-scp --disable-sftp \
--disable-shared --disable-smb --disable-smtp --disable-telnet --disable-tftp --disable-unix-sockets \
--without-brotli --without-gssapi --without-libidn2 --without-libpsl --without-librtmp --without-libssh2 \
--without-nghttp2 --without-ntlm-auth --without-ssl --without-zlib --without-zstd
macos-version-min: '10.15' # Catalina (2019)
# - name: '!ssl !debug'
# compiler: clang
# configure: --without-ssl --enable-websockets
# macos-version-min: '10.9'
# - name: '!ssl !debug'
# compiler: gcc-12
# configure: --without-ssl --enable-websockets
# macos-version-min: '10.9'
# - name: '!ssl'
# compiler: clang
# configure: --enable-debug --without-ssl --enable-websockets
# macos-version-min: '10.9'
# - name: '!ssl libssh2 AppleIDN'
# compiler: clang
# configure: --enable-debug --with-libssh2=$(brew --prefix libssh2) --without-ssl --with-apple-idn --enable-websockets
# macos-version-min: '10.9'
# - name: 'OpenSSL libssh c-ares'
# compiler: clang
# install: libssh
# configure: --enable-debug --with-libssh --with-openssl=$(brew --prefix openssl) --enable-ares --enable-websockets
# macos-version-min: '10.9'
# - name: 'OpenSSL libssh'
# compiler: llvm@15
# install: libssh
# configure: --enable-debug --with-libssh --with-openssl=$(brew --prefix openssl) --enable-websockets
# macos-version-min: '10.9'
# - name: '!ssl c-ares'
# compiler: clang
# configure: --enable-debug --enable-ares --without-ssl --enable-websockets
# macos-version-min: '10.9'
# - name: '!ssl HTTP-only'
# compiler: clang
# configure: |
# --enable-debug \
# --disable-alt-svc --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap \
# --disable-ldap --disable-pop3 --disable-rtmp --disable-rtsp --disable-scp --disable-sftp \
# --disable-shared --disable-smb --disable-smtp --disable-telnet --disable-tftp --disable-unix-sockets \
# --without-brotli --without-gssapi --without-libidn2 --without-libpsl --without-librtmp --without-libssh2 \
# --without-nghttp2 --without-ntlm-auth --without-ssl --without-zlib --without-zstd
#
# macos-version-min: '10.15' # Catalina (2019)
- name: 'SecureTransport libssh2'
compiler: clang
install: httpd
configure: --enable-debug --with-secure-transport --enable-websockets --with-libssh2=$(brew --prefix libssh2)
macos-version-min: '10.8'
- name: 'SecureTransport libssh2 10.12'
compiler: clang
configure: --enable-debug --with-secure-transport --enable-websockets --with-libssh2=$(brew --prefix libssh2)
macos-version-min: '10.12' # for monotonic timers
cflags: '-Wno-deprecated-declarations'
- name: 'SecureTransport libssh2'
compiler: gcc-12
configure: --enable-debug --with-secure-transport --enable-websockets --with-libssh2=$(brew --prefix libssh2)
macos-version-min: '10.8'
- name: 'LibreSSL'
compiler: clang
install: libressl
configure: --enable-debug --with-openssl=$(brew --prefix libressl) --enable-websockets
macos-version-min: '10.9'
- name: 'OpenSSL'
compiler: clang
configure: --enable-debug --with-openssl=$(brew --prefix openssl) --enable-websockets
macos-version-min: '10.9'
- name: 'OpenSSL torture !FTP'
compiler: clang
configure: --enable-debug --disable-shared --disable-threaded-resolver --with-openssl=$(brew --prefix openssl) --enable-websockets
tflags: -n -t --shallow=25 !FTP
macos-version-min: '10.9'
- name: 'OpenSSL torture FTP'
compiler: clang
configure: --enable-debug --disable-shared --disable-threaded-resolver --with-openssl=$(brew --prefix openssl) --enable-websockets
tflags: -n -t --shallow=20 FTP
macos-version-min: '10.9'
- name: 'OpenSSL libssh2 !ldap 10.15'
compiler: clang
configure: --enable-debug --disable-ldap --with-openssl=$(brew --prefix openssl) --enable-websockets
macos-version-min: '10.15'
# - name: 'SecureTransport libssh2 10.12'
# compiler: clang
# configure: --enable-debug --with-secure-transport --enable-websockets --with-libssh2=$(brew --prefix libssh2)
# macos-version-min: '10.12' # for monotonic timers
# cflags: '-Wno-deprecated-declarations'
# - name: 'SecureTransport libssh2'
# compiler: gcc-12
# configure: --enable-debug --with-secure-transport --enable-websockets --with-libssh2=$(brew --prefix libssh2)
# macos-version-min: '10.8'
# - name: 'LibreSSL'
# compiler: clang
# install: libressl
# configure: --enable-debug --with-openssl=$(brew --prefix libressl) --enable-websockets
# macos-version-min: '10.9'
# - name: 'OpenSSL'
# compiler: clang
# configure: --enable-debug --with-openssl=$(brew --prefix openssl) --enable-websockets
# macos-version-min: '10.9'
# - name: 'OpenSSL torture !FTP'
# compiler: clang
# configure: --enable-debug --disable-shared --disable-threaded-resolver --with-openssl=$(brew --prefix openssl) --enable-websockets
# tflags: -n -t --shallow=25 !FTP
# macos-version-min: '10.9'
# - name: 'OpenSSL torture FTP'
# compiler: clang
# configure: --enable-debug --disable-shared --disable-threaded-resolver --with-openssl=$(brew --prefix openssl) --enable-websockets
# tflags: -n -t --shallow=20 FTP
# macos-version-min: '10.9'
# - name: 'OpenSSL libssh2 !ldap 10.15'
# compiler: clang
# configure: --enable-debug --disable-ldap --with-openssl=$(brew --prefix openssl) --enable-websockets
# macos-version-min: '10.15'
steps:
- name: 'brew install'
# Run this command with retries because of spurious failures seen
Expand Down Expand Up @@ -178,7 +180,7 @@ jobs:
run: |
python3 -m venv $HOME/venv
source $HOME/venv/bin/activate
python3 -m pip install impacket
python3 -m pip install impacket pytest psutil
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

Expand Down Expand Up @@ -213,6 +215,7 @@ jobs:
fi
if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then
options+=" --target=$(uname -m)-apple-darwin"
options+=" --with-test-httpd=$(brew --prefix httpd)"
CC+=" --target=$(uname -m)-apple-darwin"
fi
if [ '${{ matrix.compiler }}' != 'clang' ]; then
Expand All @@ -239,29 +242,40 @@ jobs:
- name: 'curl version'
run: bld/src/curl --disable --version

- name: 'make examples'
run: make -C bld V=1 examples

- name: 'make tests'
run: make -C bld V=1 -C tests

- name: 'run tests'
# - name: 'make examples'
# run: make -C bld V=1 examples
#
# - name: 'make tests'
# run: make -C bld V=1 -C tests
#
# - name: 'run tests'
# run: |
# export TFLAGS='${{ matrix.tflags }} -j10'
# if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then
# TFLAGS+=' ~RTSP' # 567 568 569 570 571 572 577 689 3100
# TFLAGS+=' ~1156 ~1539' # HTTP Content-Range, Content-Length
# if [[ '${{ matrix.configure }}' = *'--with-secure-transport'* ]]; then
# TFLAGS+=' ~2100' # 2100:'HTTP GET using DoH' https://github.com/curl/curl/actions/runs/9942146678/job/27462937524#step:15:5059
# TFLAGS+=' ~HTTP/2' # 2400 2401 2402 2403 2404 2406, SecureTransport + nghttp2
# else
# TFLAGS+=' ~2402 ~2404' # non-SecureTransport + nghttp2
# fi
# fi
# rm -f $HOME/.curlrc
# make -C bld V=1 test-ci

- name: 'run pytest'
run: |
export TFLAGS='${{ matrix.tflags }} -j10'
if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then
TFLAGS+=' ~RTSP' # 567 568 569 570 571 572 577 689 3100
TFLAGS+=' ~1156 ~1539' # HTTP Content-Range, Content-Length
if [[ '${{ matrix.configure }}' = *'--with-secure-transport'* ]]; then
TFLAGS+=' ~2100' # 2100:'HTTP GET using DoH' https://github.com/curl/curl/actions/runs/9942146678/job/27462937524#step:15:5059
TFLAGS+=' ~HTTP/2' # 2400 2401 2402 2403 2404 2406, SecureTransport + nghttp2
else
TFLAGS+=' ~2402 ~2404' # non-SecureTransport + nghttp2
fi
fi
rm -f $HOME/.curlrc
make -C bld V=1 test-ci
python3 -m venv $HOME/venv
source $HOME/venv/bin/activate
python3 -m pytest -v tests -k 17_ -v -s
env:
BUILD_DIR: bld
TFLAGS: "${{ matrix.build.tflags }}"
CURL_CI: github

cmake:
if: false
name: 'CM ${{ matrix.compiler }} ${{ matrix.build.name }}'
runs-on: 'macos-latest'
timeout-minutes: 10
Expand Down Expand Up @@ -382,7 +396,7 @@ jobs:
make -C bld test-ci
combinations: # Test buildability with host OS, Xcode / SDK, compiler, target-OS, SecureTransport/not, built tool, combinations
if: true # Set to `true` to enable this test matrix. It runs quickly.
if: false # Set to `true` to enable this test matrix. It runs quickly.
name: "${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }} ${{ matrix.image }} ${{ matrix.xcode }} ${{ matrix.config }}"
runs-on: ${{ matrix.image }}
timeout-minutes: 30
Expand Down
24 changes: 11 additions & 13 deletions tests/http/testenv/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,22 @@ def init_config_from(conf_path):
return None


TESTS_HTTPD_PATH = os.path.dirname(os.path.dirname(__file__))
DEF_CONFIG = init_config_from(os.path.join(TESTS_HTTPD_PATH, 'config.ini'))

TOP_PATH = os.path.dirname(os.path.dirname(TESTS_HTTPD_PATH))
CURL = os.path.join(TOP_PATH, 'src/curl')


class EnvConfig:

def __init__(self):
self.tests_dir = TESTS_HTTPD_PATH
self.gen_dir = os.path.join(self.tests_dir, 'gen')
self.project_dir = os.path.dirname(os.path.dirname(self.tests_dir))
self.config = DEF_CONFIG
# check cur and its features
self.curl = CURL
if 'BUILD_DIR' in os.environ:
BUILD_DIR = os.path.realpath(os.environ['BUILD_DIR'])
else:
BUILD_DIR = f'{os.path.dirname(__file__)}/../../../'
self.tests_dir = os.path.normpath(f'{BUILD_DIR}/tests/http/')
self.gen_dir = os.path.normpath(f'{BUILD_DIR}/tests/http/gen')
self.project_dir = os.path.normpath(f'{BUILD_DIR}/')
self.config = init_config_from(os.path.normpath(f'{BUILD_DIR}/tests/http/config.ini'))
# check curl and its features
if 'CURL' in os.environ:
self.curl = os.environ['CURL']
else:
self.curl = os.path.normpath(f'{BUILD_DIR}/src/curl')
self.curl_props = {
'version': None,
'os': None,
Expand Down
17 changes: 17 additions & 0 deletions tests/http/testenv/httpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(self, env: Env, proxy_auth: bool = False):
self._docs_dir = os.path.join(self._apache_dir, 'docs')
self._conf_dir = os.path.join(self._apache_dir, 'conf')
self._conf_file = os.path.join(self._conf_dir, 'test.conf')
print(f'CONF_DIR: {self._conf_dir}')
self._logs_dir = os.path.join(self._apache_dir, 'logs')
self._error_log = os.path.join(self._logs_dir, 'error_log')
self._tmp_dir = os.path.join(self._apache_dir, 'tmp')
Expand Down Expand Up @@ -150,8 +151,19 @@ def start(self):
with open(os.path.join(self._apache_dir, 'xxx'), 'a') as fd:
fd.write('start of server\n')
r = self._apachectl('start')
print('******************************************************************************************************')
print('APACHECTL')
print('******************************************************************************************************')
printf(r.stdout)
print('******************************************************************************************************')
if r.exit_code != 0:
log.error(f'failed to start httpd: {r}')
with open(self._digest_passwords, 'w') as fd:
print('******************************************************************************************************')
print('APACHE LOG')
print('******************************************************************************************************')
fd.read()
print('******************************************************************************************************')
return False
self._loaded_extra_configs = copy.deepcopy(self._extra_configs)
return self.wait_live(timeout=timedelta(seconds=5))
Expand Down Expand Up @@ -377,6 +389,11 @@ def _write_config(self):
f'',
])

print('******************************************************************************************************')
print('CONF')
print('******************************************************************************************************')
print("\n".join(conf))
print('******************************************************************************************************')
fd.write("\n".join(conf))
with open(os.path.join(self._conf_dir, 'mime.types'), 'w') as fd:
fd.write("\n".join([
Expand Down

0 comments on commit 4f04acf

Please sign in to comment.