2020-07-28 21:00:35 +00:00
|
|
|
# Copyright 2019 Ilya Shipitsin <chipitsine@gmail.com>
|
|
|
|
# Copyright 2020 Tim Duesterhus <tim@bastelstu.be>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version
|
|
|
|
# 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
name: VTest
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
|
2021-10-16 16:10:26 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-07-28 21:00:35 +00:00
|
|
|
jobs:
|
|
|
|
# The generate-matrix job generates the build matrix using JSON output
|
|
|
|
# generated by .github/matrix.py.
|
|
|
|
generate-matrix:
|
|
|
|
name: Generate Build Matrix
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
|
|
steps:
|
2023-09-06 14:57:29 +00:00
|
|
|
- uses: actions/checkout@v4
|
2020-07-28 21:00:35 +00:00
|
|
|
- name: Generate Build Matrix
|
2022-12-23 13:40:04 +00:00
|
|
|
env:
|
2022-12-29 16:40:27 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2020-07-28 21:00:35 +00:00
|
|
|
id: set-matrix
|
2022-12-12 14:15:22 +00:00
|
|
|
run: python3 .github/matrix.py "${{ github.ref_name }}"
|
2020-07-28 21:00:35 +00:00
|
|
|
|
|
|
|
# The Test job actually runs the tests.
|
|
|
|
Test:
|
|
|
|
name: ${{ matrix.name }}
|
|
|
|
needs: generate-matrix
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
|
|
|
|
fail-fast: false
|
|
|
|
env:
|
|
|
|
# Configure a short TMPDIR to prevent failures due to long unix socket
|
|
|
|
# paths.
|
|
|
|
TMPDIR: /tmp
|
2022-01-15 09:23:37 +00:00
|
|
|
OT_CPP_VERSION: 1.6.0
|
2020-07-28 21:00:35 +00:00
|
|
|
steps:
|
2023-09-06 14:57:29 +00:00
|
|
|
- uses: actions/checkout@v4
|
2020-07-28 21:00:35 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 100
|
2024-03-27 15:49:54 +00:00
|
|
|
|
|
|
|
- name: Setup coredumps
|
|
|
|
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
|
|
|
run: |
|
|
|
|
sudo sysctl -w fs.suid_dumpable=1
|
|
|
|
sudo sysctl kernel.core_pattern=/tmp/core.%h.%e.%t
|
|
|
|
|
2022-01-21 19:00:44 +00:00
|
|
|
#
|
|
|
|
# Github Action cache key cannot contain comma, so we calculate it based on job name
|
|
|
|
#
|
|
|
|
- name: Generate cache key
|
|
|
|
id: generate-cache-key
|
|
|
|
run: |
|
2022-10-14 17:46:07 +00:00
|
|
|
echo "key=$(echo ${{ matrix.name }} | sha256sum | awk '{print $1}')" >> $GITHUB_OUTPUT
|
2022-01-21 19:00:44 +00:00
|
|
|
|
|
|
|
- name: Cache SSL libs
|
|
|
|
if: ${{ matrix.ssl && matrix.ssl != 'stock' && matrix.ssl != 'BORINGSSL=yes' && matrix.ssl != 'QUICTLS=yes' }}
|
|
|
|
id: cache_ssl
|
2024-02-08 18:55:23 +00:00
|
|
|
uses: actions/cache@v4
|
2022-01-21 19:00:44 +00:00
|
|
|
with:
|
|
|
|
path: '~/opt/'
|
|
|
|
key: ssl-${{ steps.generate-cache-key.outputs.key }}
|
|
|
|
|
2022-01-13 06:36:28 +00:00
|
|
|
- name: Cache OpenTracing
|
|
|
|
if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }}
|
|
|
|
id: cache_ot
|
2024-02-08 18:55:23 +00:00
|
|
|
uses: actions/cache@v4
|
2022-01-13 06:36:28 +00:00
|
|
|
with:
|
|
|
|
path: '~/opt-ot/'
|
|
|
|
key: ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }}
|
2020-07-28 21:00:35 +00:00
|
|
|
- name: Install apt dependencies
|
|
|
|
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
|
|
|
run: |
|
2024-05-31 15:04:14 +00:00
|
|
|
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
|
2024-05-29 19:59:14 +00:00
|
|
|
sudo apt-get --no-install-recommends -y install \
|
2024-05-30 13:40:31 +00:00
|
|
|
${{ contains(matrix.FLAGS, 'USE_LUA=1') && 'liblua5.4-dev' || '' }} \
|
|
|
|
${{ contains(matrix.FLAGS, 'USE_PCRE2=1') && 'libpcre2-dev' || '' }} \
|
|
|
|
${{ contains(matrix.ssl, 'BORINGSSL=yes') && 'ninja-build' || '' }} \
|
2024-03-27 15:49:54 +00:00
|
|
|
socat \
|
|
|
|
gdb
|
2020-07-28 21:00:35 +00:00
|
|
|
- name: Install brew dependencies
|
|
|
|
if: ${{ startsWith(matrix.os, 'macos-') }}
|
|
|
|
run: |
|
|
|
|
brew install socat
|
|
|
|
brew install lua
|
|
|
|
- name: Install VTest
|
|
|
|
run: |
|
2021-05-15 06:46:15 +00:00
|
|
|
scripts/build-vtest.sh
|
2020-07-28 21:00:35 +00:00
|
|
|
- name: Install SSL ${{ matrix.ssl }}
|
2022-01-21 19:00:44 +00:00
|
|
|
if: ${{ matrix.ssl && matrix.ssl != 'stock' && steps.cache_ssl.outputs.cache-hit != 'true' }}
|
2020-07-28 21:00:35 +00:00
|
|
|
run: env ${{ matrix.ssl }} scripts/build-ssl.sh
|
2021-05-18 09:46:43 +00:00
|
|
|
- name: Install OpenTracing libs
|
2022-01-13 06:36:28 +00:00
|
|
|
if: ${{ contains(matrix.FLAGS, 'USE_OT=1') && steps.cache_ot.outputs.cache-hit != 'true' }}
|
|
|
|
run: |
|
2022-01-15 09:23:37 +00:00
|
|
|
OT_PREFIX=${HOME}/opt-ot scripts/build-ot.sh
|
2020-07-28 21:00:35 +00:00
|
|
|
- name: Build WURFL
|
|
|
|
if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }}
|
2021-04-02 14:39:44 +00:00
|
|
|
run: make -C addons/wurfl/dummy
|
2020-07-28 21:00:35 +00:00
|
|
|
- name: Compile HAProxy with ${{ matrix.CC }}
|
|
|
|
run: |
|
2022-11-14 10:03:18 +00:00
|
|
|
echo "::group::Show compiler's version"
|
|
|
|
echo | ${{ matrix.CC }} -v
|
|
|
|
echo "::endgroup::"
|
2021-11-26 14:45:41 +00:00
|
|
|
echo "::group::Show platform specific defines"
|
|
|
|
echo | ${{ matrix.CC }} -dM -xc -E -
|
|
|
|
echo "::endgroup::"
|
2020-07-28 21:00:35 +00:00
|
|
|
make -j$(nproc) all \
|
|
|
|
ERR=1 \
|
|
|
|
TARGET=${{ matrix.TARGET }} \
|
|
|
|
CC=${{ matrix.CC }} \
|
2024-04-10 07:28:24 +00:00
|
|
|
DEBUG="-DDEBUG_POOL_INTEGRITY" \
|
2020-07-28 21:00:35 +00:00
|
|
|
${{ join(matrix.FLAGS, ' ') }} \
|
|
|
|
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
|
|
|
|
sudo make install
|
|
|
|
- name: Show HAProxy version
|
|
|
|
id: show-version
|
|
|
|
run: |
|
|
|
|
echo "::group::Show dynamic libraries."
|
|
|
|
if command -v ldd > /dev/null; then
|
|
|
|
# Linux
|
|
|
|
ldd $(which haproxy)
|
|
|
|
else
|
|
|
|
# macOS
|
|
|
|
otool -L $(which haproxy)
|
|
|
|
fi
|
|
|
|
echo "::endgroup::"
|
|
|
|
haproxy -vv
|
2022-10-14 17:46:07 +00:00
|
|
|
echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
|
2020-07-28 21:00:35 +00:00
|
|
|
- name: Install problem matcher for VTest
|
|
|
|
# This allows one to more easily see which tests fail.
|
|
|
|
run: echo "::add-matcher::.github/vtest.json"
|
|
|
|
- name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
|
|
|
|
id: vtest
|
2021-06-13 13:02:24 +00:00
|
|
|
run: |
|
|
|
|
# This is required for macOS which does not actually allow to increase
|
|
|
|
# the '-n' soft limit to the hard limit, thus failing to run.
|
2022-12-13 23:03:13 +00:00
|
|
|
ulimit -n 65536
|
2024-03-27 15:49:54 +00:00
|
|
|
ulimit -c unlimited
|
2024-04-22 14:15:57 +00:00
|
|
|
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
|
2023-04-01 11:29:46 +00:00
|
|
|
- name: Config syntax check memleak smoke testing
|
|
|
|
if: ${{ contains(matrix.name, 'ASAN') }}
|
|
|
|
run: |
|
2024-03-13 10:19:17 +00:00
|
|
|
./haproxy -dI -f .github/h2spec.config -c
|
|
|
|
./haproxy -dI -f examples/content-sw-sample.cfg -c
|
|
|
|
./haproxy -dI -f examples/option-http_proxy.cfg -c
|
|
|
|
./haproxy -dI -f examples/quick-test.cfg -c
|
|
|
|
./haproxy -dI -f examples/transparent_proxy.cfg -c
|
2021-12-25 08:53:04 +00:00
|
|
|
- name: Show VTest results
|
|
|
|
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
2020-07-28 21:00:35 +00:00
|
|
|
run: |
|
|
|
|
for folder in ${TMPDIR}/haregtests-*/vtc.*; do
|
|
|
|
printf "::group::"
|
|
|
|
cat $folder/INFO
|
|
|
|
cat $folder/LOG
|
|
|
|
echo "::endgroup::"
|
|
|
|
done
|
2023-07-14 22:00:49 +00:00
|
|
|
exit 1
|
2024-03-27 15:49:54 +00:00
|
|
|
|
|
|
|
- name: Show coredumps
|
|
|
|
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
|
|
|
run: |
|
|
|
|
failed=false
|
|
|
|
shopt -s nullglob
|
|
|
|
for file in /tmp/core.*; do
|
|
|
|
failed=true
|
|
|
|
printf "::group::"
|
|
|
|
gdb -ex 'thread apply all bt full' ./haproxy $file
|
|
|
|
echo "::endgroup::"
|
|
|
|
done
|
|
|
|
if [ "$failed" = true ]; then
|
|
|
|
exit 1;
|
|
|
|
fi
|