Skip to content

AutoTest

AutoTest #1309

Workflow file for this run

name: AutoTest
on:
workflow_dispatch: # manually trigger
inputs:
run_arm_tests:
description: 'Run slow ARM test jobs'
required: false
type: boolean
default: false
workflow_call:
jobs:
#Windows
win64:
runs-on: ${{ matrix.runner.runs_on }}
strategy:
fail-fast: false
matrix:
cc: [ msvc, clang, mingw_clang, mingw_gcc ]
cpp_ver: [ 11, 14, 17, 20, 23 ]
runner:
- label: "x86_64"
runs_on: windows-latest
- label: "arm64"
runs_on: windows-11-arm
exclude:
- cc: mingw_gcc
runner: 11-arm
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Install Clang
if: ${{ matrix.runner == 'windows-11-arm' }}
run: |
choco uninstall -y llvm --all-versions
choco install -y llvm
shell: powershell
- name: Install MSYS2
if: ${{ matrix.cc == 'mingw_gcc' }}
uses: msys2/setup-msys2@v2
id: msys2
with:
msystem: MINGW64
release: true
path-type: inherit
install: mingw-w64-x86_64-gcc mingw-w64-x86_64-binutils mingw-w64-x86_64-make
update: true
- name: Ensure MSYS2 packages
if: ${{ matrix.cc == 'mingw_gcc' }}
shell: msys2 {0}
run: |
pacman -S --noconfirm --needed --overwrite '*' mingw-w64-x86_64-gcc mingw-w64-x86_64-binutils mingw-w64-x86_64-make
echo "MSYS2 Root: $MSYSTEM_CARCH"
which gcc
which mingw32-make
- name: Remove conflicting MinGW paths
if: ${{ matrix.cc == 'mingw_gcc' }}
run: |
$env:Path = $env:Path -replace 'C:\\mingw64\\bin;','' -replace 'C:\\Program Files\\Git\\mingw64\\bin;',''
echo "PATH=$env:Path" >> $env:GITHUB_ENV
shell: powershell
- name: Add MSYS2 to PATH
if: ${{ matrix.cc == 'mingw_gcc' }}
run: |
$env:Path = "${{ steps.msys2.outputs.msys2-location }}\mingw64\bin;" + $env:Path
echo "PATH=$env:Path" >> $env:GITHUB_ENV
shell: powershell
- name: Build for Windows
run: |
cd build\test\win64
.\run_test_${{ matrix.cc }}.bat ${{ matrix.cpp_ver }}
#Linux-ubuntu
ubuntu:
runs-on: ${{ matrix.runner.runs_on }}
strategy:
fail-fast: false
matrix:
runner:
- label: "x86_64"
runs_on: ubuntu-latest
- label: "arm64"
runs_on: ubuntu-24.04-arm
cc: [ clang, gcc ]
cpp_ver: [ 11, 14, 17, 20, 23 ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- name: Install GDB
run: |
sudo apt-get update
sudo apt-get install -y gdb
- name: Build for Linux
run: |
cd build/test/linux
chmod +x *.sh
./run_test_${{ matrix.cc }}.sh ${{ matrix.cpp_ver }}
#linux-debian
debian:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch:
- label: "x86_64"
runs_on: ""
- label: "x86"
runs_on: "i386_"
cc: [ clang, gcc ]
cpp_ver: [ 11, 14, 17, 20, 23 ]
container:
image: ghcr.io/pippocao/bqlog/${{ matrix.arch.runs_on }}debian:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install necessary tools (gcc and clang)
run: |
apt-get update
apt-get install -y gcc clang g++ make cmake gdb
apt-get install -y software-properties-common
apt-get update
apt-get install -y openjdk-17-jdk
apt-get install -y openssh-client
- name: Set up Java
run: |
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
echo "JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64" >> $GITHUB_ENV
- name: Build for Debian
run: |
cd build/test/linux
chmod +x *.sh
./run_test_${{ matrix.cc }}.sh ${{ matrix.cpp_ver }}
#Mac
mac_silicon:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
cpp_ver: [ 11, 14, 17, 20, 23 ]
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- name: Build for macOS
run: |
cd build/test/mac
chmod +x *.sh
./run_test.sh ${{ matrix.cpp_ver }}
#Unix-FreeBSD
freeBSD_x86_64:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cc: [ gcc, clang ]
cpp_ver: [ 11, 14, 17, 20, 23 ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run in FreeBSD
id: RunInFreeBSD
uses: vmactions/freebsd-vm@v1
with:
usesh: true
mem: 8192
prepare: |
pkg install -y llvm cmake bash gdb gcc
run: |
set -e -x
cd build/test/unix_like
chmod +x *.sh
ls -l
./run_test_${{ matrix.cc }}.sh ${{ matrix.cpp_ver }}
freeBSD_arm64_test_cpp17:
if: ${{ github.event.inputs.run_arm_tests == true || github.event.inputs.run_arm_tests == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cc: [ gcc, clang ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run in FreeBSD
id: RunInFreeBSD
uses: vmactions/freebsd-vm@v1
with:
arch: aarch64
usesh: true
mem: 8192
prepare: |
pkg install -y llvm cmake bash gdb gcc13
run: |
set -e -x
cd build/test/unix_like
chmod +x *.sh
ls -l
set +e
ln -sf /usr/local/bin/gcc13 /usr/local/bin/gcc
ln -sf /usr/local/bin/g++13 /usr/local/bin/g++
ln -sf /usr/local/bin/gcov13 /usr/local/bin/gcov 2>/dev/null || true
ln -sf /usr/local/bin/gcc-ar13 /usr/local/bin/gcc-ar 2>/dev/null || true
ln -sf /usr/local/bin/gcc-ranlib13 /usr/local/bin/gcc-ranlib 2>/dev/null || true
export LD_LIBRARY_PATH=/usr/local/lib/gcc13 #Adjust according to installed GCC version
export BQ_LOW_PERFORMANCE_TESTS=true
./run_test_${{ matrix.cc }}.sh 17
EXIT_CODE=$?
set -e
if [ $EXIT_CODE -ne 0 ]; then
echo "Test failed with exit code $EXIT_CODE"
CORE_FILE="$(find . -maxdepth 5 -type f \( -name 'core' -o -name 'core.*' -o -name '*.core' \) 2>/dev/null | head -n1)"
EXE=""
for cand in ./BqLogUnitTest ./BqLogUnitTest.exe $(find . -maxdepth 5 -type f -name 'BqLogUnitTest' 2>/dev/null | head -n1); do
if [ -n "$cand" ] && [ -x "$cand" ]; then EXE="$cand"; break; fi
done
echo "exe: ${EXE:-<not found>}"
echo "core: ${CORE_FILE:-<not found>}"
if [ -n "$CORE_FILE" ] && [ -n "$EXE" ]; then
echo "=== GDB core backtrace (FreeBSD aarch64) ==="
gdb --batch -q \
-ex "set pagination off" \
-ex "info threads" \
-ex "thread apply all bt full" \
-ex "quit" \
"$EXE" "$CORE_FILE" || echo "gdb analysis failed"
else
echo "Core file or executable not found, listing candidates:"
find . -maxdepth 5 -type f \( -name 'core' -o -name 'core.*' -o -name '*.core' -o -name 'BqLogUnitTest' \) 2>/dev/null || true
fi
exit $EXIT_CODE
fi
#Unix-Solaris
solaris_x86_64_GCC:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cpp_ver: [ 11, 14, 17, 20, 23 ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run in Solaris
id: RunInSolaris
uses: vmactions/solaris-vm@v1
with:
usesh: true
mem: 8192
prepare: |
pkg publisher
pkg install -v --accept \
developer/build/cmake \
developer/build/gnu-make \
developer/debug/gdb \
developer/gcc-14 \
shell/bash
run: |
set -e -x
cd build/test/unix_like
chmod +x *.sh
ls -l
./run_test_gcc.sh ${{ matrix.cpp_ver }}
#Unix-OmnisOS
omnisOS_x86_64_GCC:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cpp_ver: [ 11, 14, 17, 20, 23 ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run in OmnisOS
id: RunInOmnisOS
uses: vmactions/omnios-vm@v1
with:
usesh: true
mem: 8192
prepare: |
set -e
pkg refresh --full
if ! pkg publisher | grep -q '^extra\.omnios'; then
REL="$(uname -v | sed -n 's/.*\(r[0-9][0-9]*\).*/\1/p')"
[ -n "$REL" ] || REL="r151054"
pkg set-publisher -g "https://pkg.omnios.org/${REL}/extra" extra.omnios || true
pkg refresh --full
fi
pkg install -v --accept shell/bash developer/build/gnu-make || true
pkg install -v --accept ooce/developer/cmake
pkg install -v --accept developer/gcc13
run: |
set -e -x
cd build/test/unix_like
chmod +x *.sh
ls -l
./run_test_gcc.sh ${{ matrix.cpp_ver }}
#Unix-DragonFlyBSD
dragonflyBSD_x86_64:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cc: [ clang, gcc ]
cpp_ver: [ 11, 14, 17, 20, 23 ]
exclude:
- cc: gcc
cpp_ver: 23
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run in DragonFlyBSD
id: DragonFlyBSD
uses: vmactions/dragonflybsd-vm@v1
with:
usesh: true
mem: 8192
prepare: |
pkg install -y cmake bash gmake gdb openjdk11 gcc llvm
run: |
set -e -x
cd build/test/unix_like
chmod +x *.sh
ls -l
./run_test_${{ matrix.cc }}.sh ${{ matrix.cpp_ver }}
#Unix-OpenBSD
openBSD_X86_64_Clang:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cpp_ver: [ 11, 14, 17, 20, 23 ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run in OpenBSD
id: OpenBSD
uses: vmactions/openbsd-vm@v1
with:
usesh: true
mem: 8192
prepare: |
set -x
export PKG_PATH="http://cdn.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(arch -s)/"
pkg_add -v -I cmake bash gdb
# --- Prepare step diagnostics ---
echo "--- GDB installation diagnostics ---"
echo "PATH=$PATH"
pkg_info | grep gdb
ls -l /usr/local/bin/gdb* /usr/bin/gdb*
echo "--- End of diagnostics ---"
run: |
set -e -x
ulimit -c unlimited || true
sysctl kern.coredump=1 || true
sysctl kern.corefile=core.%p 2>/dev/null || sysctl kern.corefile=core || true
cd build/test/unix_like
chmod +x *.sh
GDB_CMD=""
if [ -x "/usr/local/bin/gdb" ]; then
GDB_CMD="/usr/local/bin/gdb"
elif [ -x "/usr/local/bin/egdb" ]; then
GDB_CMD="/usr/local/bin/egdb"
elif [ -x "/usr/bin/gdb" ]; then
GDB_CMD="/usr/bin/gdb"
fi
if [ -n "$GDB_CMD" ]; then
echo "Found GDB at: $GDB_CMD"
if ! $GDB_CMD --version | grep "GNU gdb"; then
echo "!!! Command '$GDB_CMD' is not a valid GNU gdb. Aborting."
exit 1
fi
else
echo "!!! GNU gdb not found. Aborting."
exit 1
fi
set +e
ulimit -n
ulimit -Hn
ulimit -n 4096
./run_test_clang.sh ${{ matrix.cpp_ver }}
EXIT_CODE=$?
set -e
if [ $EXIT_CODE -ne 0 ]; then
echo "Test failed with exit $EXIT_CODE. Searching for core..."
CORE_FILE="$(find . -maxdepth 5 -type f \( -name 'core' -o -name 'core.*' -o -name '*.core' \) 2>/dev/null | head -n1)"
EXE=""
for cand in ./BqLogUnitTest ./CMakeFiles/BqLogUnitTest $(find . -maxdepth 5 -type f -name 'BqLogUnitTest' 2>/dev/null | head -n1); do
if [ -n "$cand" ] && [ -x "$cand" ]; then EXE="$cand"; break; fi
done
echo "exe: ${EXE:-<not found>}"
echo "core: ${CORE_FILE:-<not found>}"
if [ -n "$CORE_FILE" ] && [ -n "$EXE" ]; then
echo "=== GDB core backtrace ==="
$GDB_CMD --batch -q \
-ex "set pagination off" \
-ex "info threads" \
-ex "thread apply all bt full" \
-ex "quit" \
"$EXE" "$CORE_FILE" || echo "gdb core analysis failed"
elif [ -n "$EXE" ]; then
echo "Core not found; run once under gdb for live backtrace"
$GDB_CMD --batch -q \
-ex "run" \
-ex "info threads" \
-ex "thread apply all bt full" \
-ex "quit" \
"$EXE" || true
fi
exit $EXIT_CODE
fi
openBSD_arm64_Clang:
if: ${{ github.event.inputs.run_arm_tests == true || github.event.inputs.run_arm_tests == 'true'}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cpp_ver: [ 11, 14, 17, 20, 23 ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run in OpenBSD
id: OpenBSD
uses: vmactions/openbsd-vm@v1
with:
arch: aarch64
usesh: true
mem: 8192
prepare: |
pkg_add cmake bash
run: |
set -e -x
cd build/test/unix_like
chmod +x *.sh
ls -l
ulimit -n
ulimit -Hn
ulimit -n 4096
export BQ_LOW_PERFORMANCE_TESTS=true
./run_test_clang.sh ${{ matrix.cpp_ver }}
#NetBSD
netBSD_x86_64:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cc: [ clang, gcc ]
cpp_ver: [ 11, 14, 17, 20, 23 ]
exclude:
- cc: gcc
cpp_ver: 23
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run in NetBSD
id: RunInNetBSD
uses: vmactions/netbsd-vm@v1
with:
usesh: true
mem: 8192
release: "10.1"
prepare: |
set -e
export PATH="/usr/sbin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin:$PATH"
/usr/sbin/pkg_add -v pkgin || true
pkgin -y update || true
pkgin -y install cmake gmake bash gdb || true
pkgin -y install clang || true
pkgin -y install gcc12 || pkgin -y install gcc13 || pkgin -y install gcc10 || true
run: |
set -e -x
cd build/test/unix_like
chmod +x *.sh
ls -l
ulimit -n
ulimit -Hn
ulimit -n 4096
./run_test_${{ matrix.cc }}.sh ${{ matrix.cpp_ver }}
netBSD_arm64_cpp17:
if: ${{ github.event.inputs.run_arm_tests == true || github.event.inputs.run_arm_tests == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cc: [ clang, gcc ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run in NetBSD
id: RunInNetBSDArm64
uses: vmactions/netbsd-vm@v1
with:
arch: aarch64
usesh: true
mem: 8192
release: "10.1"
prepare: |
set -e
export PATH="/usr/sbin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin:$PATH"
/usr/sbin/pkg_add -v pkgin || true
pkgin -y update || true
pkgin -y install cmake gmake bash gdb || true
pkgin -y install clang || true
pkgin -y install gcc12 || pkgin -y install gcc13 || pkgin -y install gcc10 || true
run: |
set -e -x
cd build/test/unix_like
chmod +x *.sh
ls -l
ulimit -n
ulimit -Hn
ulimit -n 4096
export BQ_LOW_PERFORMANCE_TESTS=true
./run_test_${{ matrix.cc }}.sh 17
#Android Test
android:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- abi: x86
api-level: 21
- abi: x86_64
api-level: 30
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- id: setup-android
uses: android-actions/setup-android@v3
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls -l /dev/kvm || true
- id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r28c
local-cache: false
- name: Build Debug
env:
ANDROID_ABI: ${{ matrix.abi }}
ANDROID_PLATFORM: ${{ matrix.api-level }}
ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
set -e
mkdir -p build/test/android/${ANDROID_ABI}/debug
cd build/test/android/${ANDROID_ABI}/debug
cmake ../../../../../test \
-G "Unix Makefiles" \
-DANDROID_ABI=${ANDROID_ABI} \
-DANDROID_PLATFORM=${ANDROID_PLATFORM} \
-DANDROID_NDK=${ANDROID_NDK} \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
-DTARGET_PLATFORM:STRING=android
cmake --build . -- -j10
- name: Build RelWithDebInfo
env:
ANDROID_ABI: ${{ matrix.abi }}
ANDROID_PLATFORM: ${{ matrix.api-level }}
ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
set -e
mkdir -p build/test/android/${ANDROID_ABI}/relwithdebinfo
cd build/test/android/${ANDROID_ABI}/relwithdebinfo
cmake ../../../../../test \
-G "Unix Makefiles" \
-DANDROID_ABI=${ANDROID_ABI} \
-DANDROID_PLATFORM=${ANDROID_PLATFORM} \
-DANDROID_NDK=${ANDROID_NDK} \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
-DTARGET_PLATFORM:STRING=android
cmake --build . -- -j10
- name: Locate artifacts
id: locate
env:
ABI: ${{ matrix.abi }}
run: |
set -e
DBG="build/test/android/${ABI}/debug/BqLogUnitTest"
REL="build/test/android/${ABI}/relwithdebinfo/BqLogUnitTest"
[ -f "$DBG" ] || DBG="$(find build/test/android/${ABI}/debug -type f -name BqLogUnitTest | head -n1)"
[ -f "$REL" ] || REL="$(find build/test/android/${ABI}/relwithdebinfo -type f -name BqLogUnitTest | head -n1)"
echo "dbg=$DBG" >> $GITHUB_OUTPUT
echo "rel=$REL" >> $GITHUB_OUTPUT
- name: Create AVD snapshot (if missing)
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ matrix.abi }}
force-avd-creation: true
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
cores: 4
script: echo "AVD snapshot created."
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ matrix.abi }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
cores: 4
script: |
set -e
adb devices
adb push "${{ steps.locate.outputs.dbg }}" /data/local/tmp/BqLogUnitTest_dbg
adb shell "cd /data/local/tmp && chmod 755 ./BqLogUnitTest_dbg && TMPDIR=/data/local/tmp ./BqLogUnitTest_dbg"
adb push "${{ steps.locate.outputs.rel }}" /data/local/tmp/BqLogUnitTest_rel
adb shell "cd /data/local/tmp && chmod 755 ./BqLogUnitTest_rel && TMPDIR=/data/local/tmp ./BqLogUnitTest_rel"