Skip to content

Commit b9f4785

Browse files
committed
ci: run tests on a nftables only system
Signed-off-by: Adrian Reber <[email protected]>
1 parent 2b5f91f commit b9f4785

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

.github/workflows/nftables-test.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Nftables bases testing
2+
3+
on: [push, pull_request]
4+
5+
# Cancel any preceding run on the pull request.
6+
concurrency:
7+
group: nftables-test-${{ github.event.pull_request.number || github.ref }}
8+
cancel-in-progress: ${{ github.ref != 'refs/heads/criu-dev' }}
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-24.04
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Remove iptables
16+
run: sudo apt remove -y iptables
17+
- name: Install libnftables-dev
18+
run: sudo scripts/ci/apt-install libnftables-dev
19+
- name: chmod 755 /home/runner
20+
# CRIU's tests are sometimes running as some random user and need
21+
# to be able to access the test files.
22+
run: sudo chmod 755 /home/runner
23+
- name: Build with nftables network locking backend
24+
run: sudo make -C scripts/ci local COMPILE_FLAGS="NETWORK_LOCK_DEFAULT=NETWORK_LOCK_NFTABLES"

criu/cr-service.c

+3
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
582582
goto err;
583583
}
584584
}
585+
pr_debug("opts.network_lock_method %d\n", opts.network_lock_method);
585586

586587
if (req->ps) {
587588
opts.port = (short)req->ps->port;
@@ -701,6 +702,8 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
701702
if (req->lsm_profile) {
702703
opts.lsm_supplied = true;
703704
SET_CHAR_OPTS(lsm_profile, req->lsm_profile);
705+
pr_debug("opts.lsm_supplied %d\n", opts.lsm_supplied);
706+
pr_debug("lsm_profile %s\n", opts.lsm_profile);
704707
}
705708

706709
if (req->lsm_mount_context)

criu/lsm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ int render_lsm_profile(char *profile, char **val)
370370
case LSMTYPE__APPARMOR:
371371
return render_aa_profile(val, profile);
372372
case LSMTYPE__SELINUX:
373-
if (asprintf(val, "%s", profile) < 0) {
373+
if (asprintf(val, "%s", opts.lsm_supplied ? opts.lsm_profile : profile) < 0) {
374374
*val = NULL;
375375
return -1;
376376
}

scripts/ci/run-ci-tests.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ ci_prep () {
3939
# This can fail on aarch64 travis
4040
service apport stop || :
4141

42+
# Ubuntu has set up AppArmor in 24.04 so that it blocks use of user
43+
# namespaces by unprivileged users. We need this for some of our tests.
44+
sysctl kernel.apparmor_restrict_unprivileged_userns=0 || :
45+
4246
if [ "$CLANG" = "1" ]; then
4347
# clang support
4448
CC=clang
@@ -121,8 +125,14 @@ if [ "${CD_TO_TOP}" = "1" ]; then
121125
fi
122126

123127
export GCOV CC
128+
if [ -z "$COMPILE_FLAGS" ]; then
129+
LOCAL_COMPILE_FLAGS=("V=1")
130+
else
131+
IFS=" " read -r -a LOCAL_COMPILE_FLAGS <<< "$COMPILE_FLAGS"
132+
LOCAL_COMPILE_FLAGS=("V=1" "${LOCAL_COMPILE_FLAGS[@]}")
133+
fi
124134
$CC --version
125-
time make CC="$CC" -j4 V=1
135+
time make CC="$CC" -j4 "${LOCAL_COMPILE_FLAGS[@]}"
126136

127137
./criu/criu -v4 cpuinfo dump || :
128138
./criu/criu -v4 cpuinfo check || :
@@ -150,6 +160,7 @@ ulimit -c unlimited
150160
cgid=$$
151161
cleanup_cgroup() {
152162
./test/zdtm_umount_cgroups $cgid
163+
dmesg
153164
}
154165
trap cleanup_cgroup EXIT
155166
./test/zdtm_mount_cgroups $cgid

0 commit comments

Comments
 (0)