Skip to content

Handle promotion failures, deadlocks, and state transitions #5025

Handle promotion failures, deadlocks, and state transitions

Handle promotion failures, deadlocks, and state transitions #5025

name: Run Unit and Ganesha Tests
on:
merge_group:
pull_request:
push:
branches:
- dev
jobs:
Run-Unit-Tests-and-Ganesha:
runs-on: ubuntu-24.04
env:
SAUNAFS_TEST_TIMEOUT_MULTIPLIER: 2
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
# Reference for previous vcpkg setup: maybe we can fix it in the future
#- name: Setup a new (or from cache) vcpkg
# uses: lukka/run-vcpkg@v11
- name: Build and install Ganesha v7.1
run: |
set -eux
# Install build dependencies
sudo apt update
sudo apt install -y --no-install-recommends \
acl \
bison \
build-essential \
byacc \
cmake \
dbus \
docbook \
docbook-xml \
doxygen \
fio \
flex \
git \
krb5-user \
libacl1-dev \
libblkid-dev \
libboost-filesystem-dev \
libboost-iostreams-dev \
libboost-program-options-dev \
libboost-system-dev \
libcap-dev \
libdbus-1-dev \
libgssapi-krb5-2 \
libjemalloc-dev \
libjudy-dev \
libkrb5-dev \
libkrb5support0 \
libnfsidmap-dev \
libnsl-dev \
libsqlite3-dev \
libtirpc-dev \
liburcu-dev \
nfs-common \
pkg-config \
pv \
wget \
unzip \
rpcbind
# Clone and build Ganesha v7.1
cd $GITHUB_WORKSPACE
git clone https://github.com/nfs-ganesha/nfs-ganesha.git
cd nfs-ganesha
git checkout V7.1
git submodule update --recursive --init
mkdir build
cmake -B build src \
-DCMAKE_C_FLAGS="-Wno-unused-function" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_FSAL_CEPH=OFF \
-DUSE_FSAL_GLUSTER=OFF \
-DUSE_FSAL_GPFS=OFF \
-DUSE_FSAL_KVSFS=OFF \
-DUSE_FSAL_LIZARDFS=OFF \
-DUSE_FSAL_LUSTRE=OFF \
-DUSE_FSAL_PROXY_V3=OFF \
-DUSE_FSAL_PROXY_V4=OFF \
-DUSE_FSAL_RGW=OFF \
-DUSE_FSAL_XFS=OFF \
-DUSE_GSS=OFF \
-DUSE_MONITORING=OFF
sudo cmake --build build --target install
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install SaunaFS dependencies, setup environment and build
run: |
sudo mkdir /mnt/hd{b,c,d}
cd $GITHUB_WORKSPACE/tests
sudo ./setup_machine.sh setup /mnt/hdb /mnt/hdc /mnt/hdd
- name: Cache vcpkg downloads
uses: actions/cache@v4
with:
path: |
~/.cache/vcpkg
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-
- name: Setup vcpkg and install dependencies
run: |
$GITHUB_WORKSPACE/utils/vcpkg_setup.sh
vcpkg install --triplet x64-linux
- name: Build SaunaFS
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
source /var/lib/saunafs_setup_machine_venv/bin/activate
mkdir -p build
cd build
nice cmake \
-DCMAKE_TOOLCHAIN_FILE="${HOME}/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DENABLE_CLIENT_LIB=ON \
-DENABLE_DOCS=ON \
-DENABLE_NFS_GANESHA=ON \
-DENABLE_POLONAISE=OFF \
-DENABLE_URAFT=ON \
-DGSH_CAN_HOST_LOCAL_FS=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/install/saunafs/" \
-DENABLE_TESTS=ON \
-DCODE_COVERAGE=OFF \
-DSAUNAFS_TEST_POINTER_OBFUSCATION=ON \
-DENABLE_WERROR=ON \
-DENABLE_FOUNDATIONDB=ON \
"${GITHUB_WORKSPACE}"
make -j"$(nproc)" install
- name: Enable systemd core dumps
run: |
sudo mkdir -p /etc/systemd/coredump.conf.d
echo -e "[Coredump]\nStorage=external\nProcessSizeMax=2G" | sudo tee /etc/systemd/coredump.conf.d/coredump.conf
sudo systemctl daemon-reexec
- name: Run Unit Tests suite
run: |
"${GITHUB_WORKSPACE}/build/src/unittests/unittests" --gtest_color=yes
- name: Run Ganesha suite
run: |
sudo chmod o+xr /home/runner/
sudo chown saunafstest:saunafstest /mnt/saunafstest_loop_*
sudo chown saunafstest:saunafstest /mnt/hd{b,c,d}
SCRIPT="${GITHUB_WORKSPACE}/tests/ci_build/run-ganesha-tests.sh"
chmod +x "${SCRIPT}"
sudo bash -c "ulimit -c unlimited && exec '${SCRIPT}'"
- name: Analyze core dump with coredumpctl
if: failure()
run: |
echo "===== Searching for recent core dumps for ganesha.nfsd ====="
echo "Recent coredumps:"
coredumpctl --no-pager list | tail -n 5 || true
COREDUMP_INFO=$(coredumpctl --no-pager list ganesha.nfsd | tail -n 1 || true)
if [ -z "$COREDUMP_INFO" ]; then
echo "No core dump found for ganesha.nfsd"
exit 0
fi
PID=$(echo "$COREDUMP_INFO" | awk '{print $5}')
echo "Found core dump for ganesha.nfsd with PID: $PID"
# Dump the core
CORE_PATH="/tmp/core.ganesha-nfsd.${PID}"
echo "Dumping core to: $CORE_PATH"
if ! sudo coredumpctl dump "$PID" --output="$CORE_PATH"; then
echo "Error: coredumpctl failed to dump core for PID $PID"
exit 1
fi
# Find the binary
BIN_PATH=$(coredumpctl info "$PID" | grep 'Executable:' | awk '{print $2}')
echo "Executable path: $BIN_PATH"
if [ ! -f "$BIN_PATH" ]; then
echo "Binary not found at $BIN_PATH"
exit 1
fi
# Generate backtrace
BACKTRACE_FILE="${CORE_PATH}.backtrace.txt"
echo "Generating backtrace to $BACKTRACE_FILE"
if ! gdb -batch -ex "thread apply all bt full" -ex "info registers" -ex "quit" \
"$BIN_PATH" "$CORE_PATH" > "$BACKTRACE_FILE" 2> "${BACKTRACE_FILE}.stderr"; then
echo "Error: gdb failed to generate backtrace. See ${BACKTRACE_FILE}.stderr for details."
exit 1
fi
echo "===== Core Dump Backtrace (first 200 lines) ====="
head -n 200 "$BACKTRACE_FILE"
- name: Upload core dump and backtrace
if: failure()
uses: actions/upload-artifact@v4
with:
name: core-dump-ganesha
path: |
/tmp/core.ganesha-nfsd.*
if-no-files-found: warn