Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,6 @@ task:
build_script: |
make -C scripts/ci vagrant-fedora-no-vdso

task:
name: CentOS Stream 9 based test
environment:
HOME: "/root"
CIRRUS_WORKING_DIR: "/tmp/criu"

compute_engine_instance:
image_project: centos-cloud
image: family/centos-stream-9
platform: linux
cpu: 4
memory: 8G

setup_script: |
dnf config-manager --set-enabled crb # Same as CentOS 8 powertools
dnf -y install epel-release epel-next-release
contrib/dependencies/dnf-packages.sh
# The image has a too old version of nettle which does not work with gnutls.
# Just upgrade to the latest to make the error go away.
dnf -y upgrade nettle nettle-devel
systemctl stop sssd
# Even with selinux in permissive mode the selinux tests will be executed.
# The Cirrus CI user runs as a service from selinux point of view and is
# much more restricted than a normal shell (system_u:system_r:unconfined_service_t:s0).
# The test case above (vagrant-fedora-no-vdso) should run selinux tests in enforcing mode.
setenforce 0

build_script: |
make -C scripts/ci local SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1 ZDTM_OPTS="-x zdtm/static/socket-raw"

task:
name: Vagrant Fedora based test (non-root)
environment:
Expand Down
31 changes: 31 additions & 0 deletions .github/actions/lima-vm-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'Lima VM Setup'
description: 'Install Lima, enable KVM, start a VM and copy the CRIU source into it'

inputs:
template:
description: 'Lima VM template name (e.g. fedora, centos-stream-9)'
required: true
cache-key-prefix:
description: 'Prefix for the Lima image cache key'
required: true

runs:
using: composite
steps:
- name: Install Lima
uses: lima-vm/lima-actions/setup@v1
- name: Cache Lima images
uses: actions/cache@v4
with:
path: ~/.cache/lima
key: ${{ inputs.cache-key-prefix }}-${{ github.sha }}
restore-keys: ${{ inputs.cache-key-prefix }}-
- name: Start VM
shell: bash
run: limactl start --plain --name=default --cpus=4 --memory=12 template://${{ inputs.template }}
- name: Copy source into VM
shell: bash
run: |
lima sudo mkdir -p /home/criu
lima sudo chown "$(lima whoami)" /home/criu
limactl copy -r . default:/home/criu
42 changes: 28 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,31 @@ jobs:
- name: Run Arch Linux Test
run: sudo -E make -C scripts/ci archlinux

centos-stream-test:
name: CentOS Stream ${{ matrix.version }}
# aarch64 is not supported by lima-vm/lima-actions
# https://github.com/lima-vm/lima-actions/pull/1
needs: [alpine-test]
runs-on: ubuntu-24.04
timeout-minutes: 60
strategy:
matrix:
version: [9, 10]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/lima-vm-setup
with:
template: centos-stream-${{ matrix.version }}
cache-key-prefix: lima-centos-stream-${{ matrix.version }}
- name: Setup VM
run: lima sudo /home/criu/scripts/ci/lima.sh centos-stream-setup
- name: Show VM info
run: |
lima uname -a
lima cat /proc/cmdline
- name: Run tests
run: ssh -tt lima-default sudo -i /home/criu/scripts/ci/lima.sh centos-stream-test

compat-test:
needs: [alpine-test]
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -138,21 +163,10 @@ jobs:
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Install Lima
uses: lima-vm/lima-actions/setup@v1
- name: Cache Lima images
uses: actions/cache@v4
- uses: ./.github/actions/lima-vm-setup
with:
path: ~/.cache/lima
key: lima-fedora-${{ github.sha }}
restore-keys: lima-fedora-
- name: Start Fedora VM
run: limactl start --plain --name=default --cpus=4 --memory=12 template://fedora
- name: Copy source into VM
run: |
lima sudo mkdir -p /home/criu
lima sudo chown "$(lima whoami)" /home/criu
limactl copy -r . default:/home/criu
template: fedora
cache-key-prefix: lima-fedora
- name: Setup VM
run: lima sudo /home/criu/scripts/ci/lima.sh fedora-rawhide-setup
- name: Reboot VM to activate new kernel
Expand Down
39 changes: 34 additions & 5 deletions scripts/ci/lima.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,47 @@
#!/bin/bash

# This script runs inside a Lima Fedora VM to set up and run
# the Fedora Rawhide based CI tests with a vanilla kernel.
# It mirrors the logic from vagrant.sh's setup() and fedora-rawhide().
#
# This script runs inside Lima VMs to set up and run CI tests.
# It is invoked with a command name, e.g.:
# lima.sh centos-stream-setup
# lima.sh centos-stream-test
# lima.sh fedora-rawhide-setup
# lima.sh fedora-rawhide-test


set -e
set -x

CRIU_DIR="${CRIU_DIR:-/home/criu}"

centos-stream-setup() {
# Enable CRB repository
dnf config-manager --set-enabled crb
# Install EPEL
dnf -y install epel-release
# Install build/test dependencies
"${CRIU_DIR}"/contrib/dependencies/dnf-packages.sh
# Disable sssd to avoid zdtm test failures in pty04
systemctl stop sssd || true
# Set SELinux to permissive mode; selinux tests still run but
# are not blocked by the restricted service context of CI.
setenforce 0
# The rpc test cases are running as user #1000
adduser -u 1000 test
}

centos-stream-test() {
# Increase the max thread limit for the thread-bomb test
sysctl -w kernel.threads-max=100000

# Newer systemd versions limit the number of tasks per user via
# cgroup pids controller. Remove the limit for the root user.
systemctl set-property user-0.slice TasksMax=infinity

cd "${CRIU_DIR}"
make -C scripts/ci local \
SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1 \
ZDTM_OPTS="-x zdtm/static/socket-raw"
}

fedora-rawhide-setup() {
# Disable sssd to avoid zdtm test failures in pty04 due to sssd socket
systemctl mask sssd
Expand Down
20 changes: 18 additions & 2 deletions test/zdtm/transition/thread-bomb.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@
/* Having in mind setup with 64 Kb large pages */
static const size_t stack_size = 64 * 1024;

#define EAGAIN_RETRIES 50
#define EAGAIN_DELAY_US 10000

Check warning on line 18 in test/zdtm/transition/thread-bomb.c

View workflow job for this annotation

GitHub Actions / build


static int pthread_create_retry(pthread_t *t, const pthread_attr_t *a,
void *(*fn)(void *), void *arg)
{
int err, retries = 0;

while (1) {
err = pthread_create(t, a, fn, arg);
if (err != EAGAIN || ++retries > EAGAIN_RETRIES)
return err;
usleep(EAGAIN_DELAY_US);
}
}

static void *thread_fn(void *arg)
{
pthread_t t, p, *self;
Expand All @@ -37,7 +53,7 @@

*self = pthread_self();

err = pthread_create(&t, &attr, thread_fn, self);
err = pthread_create_retry(&t, &attr, thread_fn, self);
if (err) {
pr_err("pthread_create(): %d\n", err);
free(self);
Expand Down Expand Up @@ -73,7 +89,7 @@

for (i = 0; i < max_nr; i++) {
pthread_t p;
err = pthread_create(&p, &attr, thread_fn, NULL);
err = pthread_create_retry(&p, &attr, thread_fn, NULL);
if (err) {
pr_err("pthread_create(): %d\n", err);
exit(1);
Expand Down
Loading