-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add integration testing, misc cleanup
Right now we only have unit tests that run unprivileged. Add a proper "integration test" (ok it's a lame shell script) that runs as root and creates and mounts a composefs and does some sanity checking. (This could obviously be greatly extended, this is just to have a starting point) While we have the patient open - The only CI tests were doing *cross* builds; i.e. we were ignoring x86_64. Add a non-cross build, and capture its result (as a tarball) for integration testing - Add `hacking/installdeps.sh` which captures our build dependencies for Debian at least and can be reused by mutiple jobs - Add `permissions: actions: read` because we don't want our actions to be able to mutate anything - this makes untrusted PRs much safer
- Loading branch information
Showing
3 changed files
with
87 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -xeuo pipefail | ||
export DEBIAN_FRONTEND=noninteractive | ||
apt-get install -y automake libtool autoconf autotools-dev git make gcc libyajl-dev libssl-dev libfsverity-dev pkg-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# A basic integration test for composefs; we capture /usr/bin | ||
# from the host environment into a cfs, then mount it and compare | ||
# the output of ls -lR (without hardlink counts). | ||
set -xeuo pipefail | ||
|
||
# ls -l but without hardlinks | ||
nonhardlink_ls() { | ||
ls "$@" | sed -e 's,^\([^ ]*\) *\([0-9][0-9]*\)\(.*\)$,\1\3,' | ||
} | ||
|
||
cfsroot=/composefs | ||
rm ${cfsroot}/tmp -rf | ||
mkdir -p ${cfsroot}/{objects,roots,tmp} | ||
|
||
cd ${cfsroot}/tmp | ||
testsrc=/usr/bin | ||
mkcomposefs --digest-store=${cfsroot}/objects ${testsrc} ${cfsroot}/roots/test.cfs | ||
|
||
mkdir -p mnt | ||
mount.composefs -o basedir=${cfsroot}/objects ${cfsroot}/roots/test.cfs mnt | ||
(cd ${testsrc} && nonhardlink_ls -lR .) > src-ls.txt | ||
(cd mnt && nonhardlink_ls -lR .) > mnt-ls.txt | ||
failed= | ||
if ! diff -u src-ls.txt mnt-ls.txt; then | ||
failed=1 | ||
fi | ||
umount mnt | ||
if test -n "${failed}"; then | ||
exit 1 | ||
fi |