Skip to content

Commit

Permalink
tests: Add a flow for integration test with fsverity enabled
Browse files Browse the repository at this point in the history
This was an obvious CI coverage gap.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Oct 2, 2024
1 parent ce8dd63 commit 88b55b4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ jobs:
- run: sudo apt-get update -y
- name: Install erofs kmod
run: sudo apt install linux-modules-extra-$(uname -r)
- name: Install sanitizer dependencies
run: sudo apt install libasan6 libubsan1
- name: Install dependencies
run: sudo apt install libasan6 libubsan1 fsverity
- name: Checkout repository
uses: actions/checkout@v3
- name: Download
Expand All @@ -167,6 +167,8 @@ jobs:
- run: sudo tar -C / -xvf composefs.tar
- name: Integration tests
run: sudo ./tests/integration.sh
- name: Integration tests (fsverity required)
run: sudo env WITH_TEMP_VERITY=1 unshare -m ./tests/integration.sh
rust:
needs: build-noasan
runs-on: ubuntu-latest
Expand Down
16 changes: 16 additions & 0 deletions tests/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
# the output of ls -lR (without hardlink counts).
set -xeuo pipefail

# Set to setup an explicit temporary ext4 loopback mounted fs with fsverity
WITH_TEMP_VERITY=${WITH_TEMP_VERITY:-}
if test -n "${WITH_TEMP_VERITY}"; then
tmpdisk=$(mktemp -p /var/tmp)
truncate -s 100G ${tmpdisk}
mkfs.ext4 -O verity ${tmpdisk}
tmp_mnt=$(mktemp -d)
mount -o loop ${tmpdisk} ${tmp_mnt}
rm -f ${tmpdisk}
cfsroot=${tmp_mnt}
fi

orig=$(pwd)
cfsroot=${cfsroot:-/composefs}
rm ${cfsroot}/tmp -rf
Expand Down Expand Up @@ -56,6 +68,10 @@ echo "fsverity test" > ${cfsroot}/test-fsverity
if fsverity enable ${cfsroot}/test-fsverity; then
echo "fsverity is supported"
else
if test -n "${WITH_TEMP_VERITY}"; then
echo "fsverity unsupported, but is required" 1>&2
exit 1
fi
echo "fsverity unsupported"
fi
rm -f ${cfsroot}/test-fsverity
Expand Down

0 comments on commit 88b55b4

Please sign in to comment.