Skip to content

Optimization and more tests #2016

Optimization and more tests

Optimization and more tests #2016

Workflow file for this run

name: Build UC2
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
buildType:
description: 'Build Type'
required: false
default: ''
type: choice
options:
- 'Debug'
- 'Release'
push:
paths-ignore:
- ".gitignore"
- "AUTHORS.TXT"
- "COPYING"
- "COPYING.LGPL2"
- "COPYING_GLIB"
- "CREDITS.TXT"
- "ChangeLog"
- "README.md"
- "docs/**"
pull_request:
env:
# Specify build type either according to the tag release or manual override
BUILD_TYPE: ${{ inputs.buildType != '' && inputs.buildType || startsWith(github.ref, 'refs/tags') && 'Release' || 'Debug' }}
jobs:
Windows:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}
strategy:
fail-fast: false
matrix:
config:
- {
os: windows-2022,
arch: x64,
name: 'windows-x64 MINGW64 shared',
shared: 'yes',
mingw: MINGW64,
mingw-arch: x86_64,
artifact: 'windows-mingw64-shared.7z',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: windows-2022,
arch: x64,
name: 'windows-x64 MINGW64 static',
shared: 'no',
mingw: MINGW64,
mingw-arch: x86_64,
artifact: 'windows-mingw64-static.7z',
archiver: '7z a',
generators: 'Ninja'
}
- { # This fails randomly which can't be reproduced.
os: windows-2022,
arch: x64,
name: 'windows-x64 MINGW32 shared',
shared: "yes",
mingw: MINGW32,
mingw-arch: i686,
artifact: 'windows-mingw32-shared.7z',
archiver: '7z a',
generators: 'Ninja'
}
- { # This fails randomly which can't be reproduced.
os: windows-2022,
arch: x64,
name: 'windows-x64 MINGW32 static',
shared: "no",
mingw: MINGW32,
mingw-arch: i686,
artifact: 'windows-mingw32-static.7z',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: windows-2022,
arch: x64,
name: 'windows-x64 MSVC 64bit shared',
msvc-arch: x64,
artifact: 'windows-msvc64-shared.7z',
shared: 'yes',
archiver: '7z a',
generators: 'Visual Studio 17 2022'
}
- {
os: windows-2022,
arch: x86,
name: 'windows-x86 MSVC 32bit shared',
msvc-arch: x86,
artifact: 'windows-msvc32-shared.7z',
shared: 'yes',
archiver: '7z a',
generators: 'Visual Studio 17 2022'
}
- {
os: windows-2022,
arch: x64,
name: 'windows-x64 MSVC 64bit static',
msvc-arch: x64,
artifact: 'windows-msvc64-static.7z',
shared: 'no',
archiver: '7z a',
generators: 'Visual Studio 17 2022'
}
- {
os: windows-2022,
arch: x86,
name: 'windows-x86 MSVC 32bit static',
msvc-arch: x86,
artifact: 'windows-msvc32-static.7z',
shared: 'no',
archiver: '7z a',
generators: 'Visual Studio 17 2022'
}
compiler: [ gcc ]
steps:
- uses: actions/checkout@v4
- name: 'Determine test parallelism'
shell: pwsh
run: |
"CTEST_PARALLEL_LEVEL=$([Environment]::ProcessorCount)" |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: '🛠️ Win MINGW setup'
if: contains(matrix.config.mingw, 'MINGW')
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.mingw }}
install: >-
mingw-w64-${{ matrix.config.mingw-arch }}-cmake
mingw-w64-${{ matrix.config.mingw-arch }}-ninja
mingw-w64-${{ matrix.config.mingw-arch }}-cmocka
mingw-w64-${{ matrix.config.mingw-arch }}-${{ matrix.compiler }}
mingw-w64-${{ matrix.config.mingw-arch }}-toolchain
- name: '🛠️ Win MSVC 64 setup'
if: contains(matrix.config.name, 'MSVC 64')
uses: microsoft/setup-msbuild@v2
- name: '🛠️ Win MSVC 64 dev cmd setup'
if: contains(matrix.config.name, 'MSVC 64')
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: '🚧 Win MSVC 64 build'
if: contains(matrix.config.name, 'MSVC 64')
shell: bash
run: |
choco install ninja
ninja --version
cmake --version
mkdir build
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir \
-DBUILD_SHARED_LIBS=${{ matrix.config.shared }}
cmake --build . --config ${{ env.BUILD_TYPE }}
cmake --install . --strip --config ${{ env.BUILD_TYPE }}
ctest --parallel "$CTEST_PARALLEL_LEVEL" --output-on-failure -C ${{ env.BUILD_TYPE }}
# vctip.exe (MSVC telemetry) and antivirus scans may transiently hold
# handles inside the build directory and make the rename fail, so
# retry for a while, killing vctip on each attempt
tries=0
until mv ${{ env.BUILD_TYPE }} instdir; do
tries=$((tries+1))
if [ $tries -ge 12 ]; then echo "mv keeps failing, giving up"; exit 1; fi
taskkill //IM vctip.exe //F || true
sleep 5
done
- name: '🛠️ Win MSVC 32 setup'
if: contains(matrix.config.name, 'MSVC 32')
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
- name: '🚧 Win MSVC 32 build'
if: contains(matrix.config.name, 'MSVC 32')
shell: bash
run: |
choco install ninja
ninja --version
cmake --version
mkdir build
cmake \
-S . \
-B . \
-A "win32" \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir \
-DBUILD_SHARED_LIBS=${{ matrix.config.shared }}
cmake --build . --config ${{ env.BUILD_TYPE }}
cmake --install . --strip --config ${{ env.BUILD_TYPE }}
ctest --parallel "$CTEST_PARALLEL_LEVEL" --output-on-failure -C ${{ env.BUILD_TYPE }}
# vctip.exe (MSVC telemetry) and antivirus scans may transiently hold
# handles inside the build directory and make the rename fail, so
# retry for a while, killing vctip on each attempt
tries=0
until mv ${{ env.BUILD_TYPE }} instdir; do
tries=$((tries+1))
if [ $tries -ge 12 ]; then echo "mv keeps failing, giving up"; exit 1; fi
taskkill //IM vctip.exe //F || true
sleep 5
done
- name: '🚧 Win MINGW build'
if: contains(matrix.config.mingw, 'MINGW')
shell: msys2 {0}
run: |
if [ ${{ matrix.config.mingw }} == 'MINGW32' ]; then
export CPPFLAGS=-D__USE_MINGW_ANSI_STDIO=1
#export CC=i686-w64-mingw32-gcc
export AR=gcc-ar
export RANLIB=gcc-ranlib
export CFLAGS="-m32 -static"
export LDFLAGS="-m32"
export LDFLAGS_STATIC="-m32"
export UNICORN_QEMU_FLAGS="--cpu=i386"
fi
mkdir build
mkdir instdir
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir \
-DCMAKE_C_FLAGS:STRING="-static" \
-DBUILD_SHARED_LIBS=${{ matrix.config.shared }}
cmake --build . --config ${{ env.BUILD_TYPE }}
cmake --install . --strip
ctest --parallel "$CTEST_PARALLEL_LEVEL" --output-on-failure -C ${{ env.BUILD_TYPE }}
- name: '📦 Pack artifact'
if: always()
shell: bash
working-directory: instdir
run: |
ls -laR
${{ matrix.config.archiver }} ../${{ matrix.config.artifact }} . ../test*
- name: '📤 Upload artifact'
if: always()
id: upload_artifact
continue-on-error: true
uses: actions/upload-artifact@v4
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
compression-level: 0
- name: '📤 Retry artifact upload'
if: steps.upload_artifact.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
compression-level: 0
overwrite: true
Macos:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }} - ${{ matrix.compiler }}
strategy:
fail-fast: false
matrix:
config:
# x64 builds cross-compile on the arm64 runners via ARCHFLAGS
# (see CMakeLists.txt); their tests run under Rosetta 2.
- {
os: macos-latest,
arch: x64,
archflags: '-arch x86_64',
name: 'macos-x64 cmake shared',
shared: 'yes',
artifact: 'macos-x64-cmake-shared-x64.7z',
archiver: '7za a',
generators: 'Ninja'
}
- {
os: macos-latest,
arch: x64,
archflags: '-arch x86_64',
name: 'macos-x64 cmake static',
shared: 'no',
artifact: 'macos-x64-cmake-static-x64.7z',
archiver: '7za a',
generators: 'Ninja'
}
- {
os: macos-latest,
arch: arm64,
archflags: '-arch arm64',
name: 'macos-arm64 cmake shared',
shared: 'yes',
artifact: 'macos-arm64-cmake-shared-x64.7z',
archiver: '7za a',
generators: 'Ninja'
}
- {
os: macos-latest,
arch: arm64,
archflags: '-arch arm64',
name: 'macos-arm64 cmake static',
shared: 'no',
artifact: 'macos-arm64-cmake-static-x64.7z',
archiver: '7za a',
generators: 'Ninja'
}
- {
os: macos-15-intel,
arch: x86_64,
name: 'android cmake',
artifact: 'Android-x86_64.7z',
archiver: '7za a',
generators: 'Ninja'
}
compiler: [ gcc ]
steps:
- uses: actions/checkout@v4
- name: 'Determine test parallelism'
shell: bash
run: echo "CTEST_PARALLEL_LEVEL=$(sysctl -n hw.logicalcpu)" >> "$GITHUB_ENV"
- name: '🚧 Mac build'
if: contains(matrix.config.name, 'macos')
shell: bash
env:
ARCHFLAGS: ${{ matrix.config.archflags }}
run: |
ninja --version
cmake --version
mkdir build
mkdir instdir
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir \
-DBUILD_SHARED_LIBS=${{ matrix.config.shared }}
cmake --build . --config ${{ env.BUILD_TYPE }}
cmake --install . --strip
ctest --parallel "$CTEST_PARALLEL_LEVEL" --output-on-failure -C ${{ env.BUILD_TYPE }}
- name: '🚧 Android x86_64 build'
if: contains(matrix.config.name, 'android')
shell: bash
run: |
mkdir build
mkdir instdir
cmake . -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \
-DANDROID_PLATFORM=android-28 \
-DANDROID_NDK="$ANDROID_NDK" \
-DANDROID_ABI=${{ matrix.config.arch }} \
-DOLP_SDK_ENABLE_TESTING=NO \
-DOLP_SDK_BUILD_EXAMPLES=ON \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
cmake --build . --config ${{ env.BUILD_TYPE }}
cmake --install . --strip
- name: '🚧 AVD Cache'
if: contains(matrix.config.name, 'android')
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-28
- name: '🚧 Create x86_64 tests environment'
if: contains(matrix.config.name, 'android') && steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 28
arch: ${{ matrix.config.arch }}
force-avd-creation: false
disable-animations: false
target: default
profile: Nexus 6
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -verbose -show-kernel
script: echo "Generated AVD snapshot for caching."
- name: '🚧 Android x86_64 tests'
if: contains(matrix.config.name, 'android')
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 28
force-avd-creation: false
disable-animations: true
arch: ${{ matrix.config.arch }}
target: default
profile: Nexus 6
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -verbose -show-kernel
script: bash ./adb.sh
- name: '📦 Pack artifact'
if: always()
shell: bash
working-directory: instdir
run: |
ls -laR
${{ matrix.config.archiver }} ../${{ matrix.config.artifact }} . ../test*
- name: '📤 Upload artifact'
if: always()
id: upload_artifact
continue-on-error: true
uses: actions/upload-artifact@v4
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
compression-level: 0
- name: '📤 Retry artifact upload'
if: steps.upload_artifact.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
compression-level: 0
overwrite: true
Linux:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }} - ${{ matrix.compiler }}
strategy:
fail-fast: false
matrix:
config:
- {
os: ubuntu-latest,
arch: x64,
name: 'ubuntu-x64 cmake shared',
shared: 'yes',
artifact: 'ubuntu-cmake-shared-x64.7z',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: ubuntu-latest,
arch: x86,
name: 'ubuntu-x86 cmake shared',
shared: 'yes',
artifact: 'ubuntu-cmake-shared-x86.7z',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: ubuntu-latest,
arch: x64,
name: 'ubuntu-x64 cmake static',
shared: 'no',
artifact: 'ubuntu-cmake-static-x64.7z',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: ubuntu-latest,
arch: x86,
name: 'ubuntu-x86 cmake static',
shared: 'no',
artifact: 'ubuntu-cmake-static-x86.7z',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: ubuntu-24.04-arm,
arch: aarch64,
name: 'ubuntu-aarch64 cmake',
artifact: 'ubuntu-cmake-aarch64.7z',
archiver: '7z a',
generators: 'Ninja',
distro: ubuntu24.04
}
- {
os: ubuntu-22.04,
arch: ppc64le,
name: 'ubuntu-ppc64le cmake',
artifact: 'ubuntu-cmake-ppc64le.7z',
archiver: '7z a',
generators: 'Ninja',
distro: ubuntu22.04
}
compiler: [ gcc ]
steps:
- uses: actions/checkout@v4
- name: 'Determine test parallelism'
shell: bash
run: echo "CTEST_PARALLEL_LEVEL=$(getconf _NPROCESSORS_ONLN)" >> "$GITHUB_ENV"
- name: '🚧 Linux x64/x86 build'
if: contains(matrix.config.arch, 'x64') || contains(matrix.config.arch, 'x86')
shell: bash
run: |
if [ ${{ matrix.config.arch }} == 'x64' ]; then
sudo apt-get update -q -y
sudo apt install -q -y libcmocka-dev ninja-build
else
export CFLAGS="-m32" LDFLAGS="-m32" LDFLAGS_STATIC="-m32" UNICORN_QEMU_FLAGS="--cpu=i386"
sudo dpkg --add-architecture i386
sudo apt-get update -q -y
sudo apt install -q -y lib32ncurses-dev lib32z1-dev lib32gcc-9-dev libc6-dev-i386 gcc-multilib \
libcmocka-dev:i386 libcmocka0:i386 libc6:i386 libgcc-s1:i386 ninja-build
fi
mkdir build
mkdir instdir
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir \
-DBUILD_SHARED_LIBS=${{ matrix.config.shared }}
cmake --build . --config ${{ env.BUILD_TYPE }}
cmake --install . --strip
ctest --parallel "$CTEST_PARALLEL_LEVEL" --output-on-failure -C ${{ env.BUILD_TYPE }}
- name: '🚧 Linux aarch64 build'
if: contains(matrix.config.arch, 'aarch64')
shell: bash
run: |
sudo apt-get update -q -y
sudo apt-get install -q -y cmake build-essential automake libcmocka-dev pkg-config ${{ matrix.compiler }} ninja-build
mkdir build
mkdir instdir
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
cmake --build . --config ${{ env.BUILD_TYPE }}
cmake --install . --strip
ctest --parallel "$CTEST_PARALLEL_LEVEL" --output-on-failure -C ${{ env.BUILD_TYPE }}
- name: '🚧 Linux ppc64le build'
if: contains(matrix.config.arch, 'ppc64le')
uses: uraimo/run-on-arch-action@v3
with:
arch: ${{ matrix.config.arch }}
distro: ${{ matrix.config.distro }}
setup: |
mkdir -p "${PWD}/instdir"
dockerRunArgs: |
--volume "${PWD}/instdir:/instdir"
shell: /bin/sh
install: |
apt-get update -q -y
apt-get install -q -y cmake build-essential automake libcmocka-dev pkg-config ${{ matrix.compiler }} ninja-build
run: |
mkdir build
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=/instdir
cmake --build . --config ${{ env.BUILD_TYPE }}
cmake --install . --strip
ctest --parallel "$(getconf _NPROCESSORS_ONLN)" --output-on-failure -C ${{ env.BUILD_TYPE }}
- name: '📦 Pack artifact'
if: always()
shell: bash
working-directory: instdir
run: |
ls -laR
${{ matrix.config.archiver }} ../${{ matrix.config.artifact }} . ../test*
- name: '📤 Upload artifact'
if: always()
id: upload_artifact
continue-on-error: true
uses: actions/upload-artifact@v4
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
compression-level: 0
- name: '📤 Retry artifact upload'
if: steps.upload_artifact.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
compression-level: 0
overwrite: true
PythonRegressions:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
name: 'python regressions'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: 'Build current Python binding library'
shell: bash
run: |
workers=$(getconf _NPROCESSORS_ONLN)
python_executable=$(python -c 'import sys; print(sys.executable)')
python -m pip install --disable-pip-version-check capstone==6.0.0a2
cmake \
-S . \
-B build-python-regressions \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DPYTHON_EXECUTABLE="$python_executable" \
-DUNICORN_TEST_PYTHON_REGRESSIONS=ON
cmake --build build-python-regressions \
--target unicorn --parallel "$workers"
ctest \
--test-dir build-python-regressions \
--label-regex python-regression \
--parallel "$workers" \
--no-tests=error \
--output-on-failure
FuzzSanitizers:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
name: 'clang asan ubsan libfuzzer'
env:
ASAN_OPTIONS: detect_leaks=1:abort_on_error=1
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1
steps:
- uses: actions/checkout@v4
- name: 'Build fuzz targets'
shell: bash
run: |
workers=$(getconf _NPROCESSORS_ONLN)
sanitizer_flags='-fsanitize=address,undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer'
cmake \
-S . \
-B build-fuzz \
-G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_C_FLAGS="$sanitizer_flags" \
-DCMAKE_EXE_LINKER_FLAGS='-fsanitize=address,undefined' \
-DCMAKE_SHARED_LINKER_FLAGS='-fsanitize=address,undefined' \
-DUNICORN_BUILD_TESTS=OFF \
-DUNICORN_FUZZ=ON \
-DUNICORN_FUZZ_LIBFUZZER=ON \
-DUNICORN_INSTALL=OFF
cmake --build build-fuzz --parallel "$workers"
- name: 'Run nested timeout sanitizer regression'
shell: bash
run: |
workers=$(getconf _NPROCESSORS_ONLN)
sanitizer_flags='-fsanitize=address,undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer'
cmake \
-S . \
-B build-sanitizer-tests \
-G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_C_FLAGS="$sanitizer_flags" \
-DCMAKE_EXE_LINKER_FLAGS='-fsanitize=address,undefined' \
-DCMAKE_SHARED_LINKER_FLAGS='-fsanitize=address,undefined' \
-DUNICORN_ARCH=x86 \
-DUNICORN_BUILD_TESTS=ON \
-DUNICORN_FUZZ=OFF \
-DUNICORN_INSTALL=OFF
cmake --build build-sanitizer-tests \
--target test_ctl --parallel "$workers"
ctest \
--test-dir build-sanitizer-tests \
--show-only \
--tests-regex '^unit[.]test_ctl[.]test_uc_nested_timeout$'
timeout --signal=TERM --kill-after=5s 60s ctest \
--test-dir build-sanitizer-tests \
--tests-regex '^unit[.]test_ctl[.]test_uc_nested_timeout$' \
--no-tests=error \
--output-on-failure
- name: 'Run fuzz'
shell: bash
run: |
cp -R tests/fuzz/corpus/fuzz_uc_api build-fuzz/corpus-api
mkdir -p build-fuzz/artifacts
for target_path in build-fuzz/fuzz_emu_*; do
if [ ! -x "$target_path" ]; then
continue
fi
target=$(basename "$target_path")
artifact_dir="build-fuzz/artifacts/$target/"
corpus_dir=$(mktemp -d "build-fuzz/corpus-$target.XXXXXX")
cp -R tests/fuzz/corpus/raw/. "$corpus_dir"
mkdir -p "$artifact_dir"
"$target_path" \
-runs=64 \
-timeout=5 \
-max_len=4096 \
-artifact_prefix="$artifact_dir" \
-dict=tests/fuzz/corpus/fuzz_emu.dict \
"$corpus_dir"
done
mkdir -p build-fuzz/artifacts/fuzz_uc_api
build-fuzz/fuzz_uc_api \
-runs=128 \
-timeout=5 \
-max_len=4096 \
-artifact_prefix=build-fuzz/artifacts/fuzz_uc_api/ \
-dict=tests/fuzz/corpus/fuzz_uc_api.dict \
build-fuzz/corpus-api
- name: '📤 Upload fuzz artifacts'
if: failure()
uses: actions/upload-artifact@v4
with:
name: fuzz-sanitizer-artifacts
path: build-fuzz/artifacts
if-no-files-found: ignore
AlpineLinux:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }} - ${{ matrix.compiler }}
strategy:
fail-fast: false
matrix:
config:
- {
os: ubuntu-latest,
arch: x86_64,
name: 'alpine-x86_64 cmake shared',
shared: 'yes',
artifact: 'alpine-cmake-shared-x86_64.7z',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: ubuntu-latest,
arch: x86_64,
name: 'alpine-x86_64 cmake static',
shared: 'no',
artifact: 'alpine-cmake-static-x86_64.7z',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: ubuntu-latest,
arch: x86,
name: 'alpine-x86 cmake shared',
shared: 'yes',
artifact: 'alpine-cmake-shared-x86.7z',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: ubuntu-latest,
arch: x86,
name: 'alpine-x86 cmake static',
shared: 'no',
artifact: 'alpine-cmake-static-x86.7z',
archiver: '7z a',
generators: 'Ninja'
}
- {
os: ubuntu-latest,
arch: aarch64,
name: 'alpine-aarch64 cmake',
artifact: 'alpine-cmake-aarch64.7z',
archiver: '7z a',
generators: 'Ninja',
distro: ubuntu24.04
}
- {
os: ubuntu-latest,
arch: ppc64le,
name: 'alpine-ppc64le cmake',
artifact: 'alpine-cmake-ppc64le.7z',
archiver: '7z a',
generators: 'Ninja',
distro: ubuntu24.04
}
compiler: [ gcc ]
steps:
- uses: actions/checkout@v4
- name: 'Determine test parallelism'
shell: bash
run: echo "CTEST_PARALLEL_LEVEL=$(getconf _NPROCESSORS_ONLN)" >> "$GITHUB_ENV"
- name: 'Bootstrap Alpine apk-tools'
shell: bash
env:
APK_TOOLS_PACKAGE_URL: https://dl-cdn.alpinelinux.org/alpine/v3.22/main/x86_64/apk-tools-static-2.14.10-r0.apk
APK_TOOLS_SHA256: f9c4c5675cdbf597a151aab6a9ba05983bfe5d927632c36c4575e7551ff55608
run: |
set -euo pipefail
package="$RUNNER_TEMP/apk-tools-static.apk"
extract_dir="$(mktemp -d "$RUNNER_TEMP/apk-tools-static.XXXXXX")"
curl --fail --location --show-error --silent \
--retry 5 --retry-delay 2 --retry-all-errors \
--connect-timeout 30 --max-time 180 \
--output "$package" "$APK_TOOLS_PACKAGE_URL"
tar -xzf "$package" -C "$extract_dir" sbin/apk.static
printf '%s %s\n' "$APK_TOOLS_SHA256" \
"$extract_dir/sbin/apk.static" | sha256sum --check -
install -m 0755 "$extract_dir/sbin/apk.static" "$RUNNER_TEMP/apk"
nohup python3 -m http.server 38473 --bind 127.0.0.1 \
--directory "$extract_dir/sbin" \
>"$RUNNER_TEMP/apk-http.log" 2>&1 &
echo $! >"$RUNNER_TEMP/apk-http.pid"
- name: '🚧 Setup Alpine Linux'
uses: jirutka/setup-alpine@v1
with:
apk-tools-url: 'http://127.0.0.1:38473/apk.static#!sha256!f9c4c5675cdbf597a151aab6a9ba05983bfe5d927632c36c4575e7551ff55608'
branch: v3.22
arch: ${{ matrix.config.arch }}
mirror-url: https://dl-cdn.alpinelinux.org/alpine
packages: cmake build-base automake cmocka-dev pkgconfig ${{ matrix.compiler }} ninja linux-headers
- name: 'Stop Alpine bootstrap server'
if: always()
shell: bash
run: |
if [[ -f "$RUNNER_TEMP/apk-http.pid" ]]; then
kill "$(cat "$RUNNER_TEMP/apk-http.pid")" || true
fi
- name: '🚧 Linux Alpine build'
shell: alpine.sh --root {0}
run: |
mkdir build
mkdir instdir
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir \
-DBUILD_SHARED_LIBS=${{ matrix.config.shared }}
cmake --build . --config ${{ env.BUILD_TYPE }}
cmake --install . --strip
ctest --parallel "$CTEST_PARALLEL_LEVEL" --output-on-failure -C ${{ env.BUILD_TYPE }}
- name: '📦 Pack artifact'
if: always()
shell: bash
working-directory: instdir
run: |
ls -laR
${{ matrix.config.archiver }} ../${{ matrix.config.artifact }} . ../test*
- name: '📤 Upload artifact'
if: always()
id: upload_artifact
continue-on-error: true
uses: actions/upload-artifact@v4
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
compression-level: 0
- name: '📤 Retry artifact upload'
if: steps.upload_artifact.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
compression-level: 0
overwrite: true