summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2023-09-24 19:39:33 +0200
committerHelmut Grohne <helmut@subdivi.de>2023-09-24 21:45:13 +0200
commitc63eb6291986dd813a74e76fdccf06900669c957 (patch)
treec98832fe621676c27f3c3174e415ca1f130ea47d
parent4252a8c46af88baf8949da84ab21e8f79585a2f4 (diff)
downloaddebvm-c63eb6291986dd813a74e76fdccf06900669c957.tar.gz
make autopkgtest non-flaky
When passing an empty release to ./tests/create-and-run.sh, we now use the host's apt sources and pinning. This is an additional gitlab-ci test and replaces the previous autopkgtest involving unstable, which thus becomes non-flaky.
-rw-r--r--.gitlab-ci.yml7
-rw-r--r--debian/tests/control12
-rwxr-xr-xtests/create-and-run.sh22
3 files changed, 31 insertions, 10 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ec5bc48..188d919 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -31,6 +31,13 @@ release_test:
- apt-get --no-install-recommends --yes install curl e2fsprogs genext2fs mmdebstrap openssh-client qemu-kvm dpkg-dev
- PATH=$(pwd)/bin:$PATH ./tests/create-and-run.sh $(dpkg --print-architecture) "$RELEASE"
+debci_test:
+ script:
+ - apt-get update
+ - apt-get dist-upgrade --yes
+ - apt-get --no-install-recommends --yes install e2fsprogs genext2fs mmdebstrap openssh-client qemu-kvm dpkg-dev
+ - PATH=$(pwd)/bin:$PATH ./tests/create-and-run.sh $(dpkg --print-architecture) ""
+
arch_test:
parallel:
matrix:
diff --git a/debian/tests/control b/debian/tests/control
index e72580a..9888f95 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,12 +1,12 @@
-Test-Command: ./tests/create-and-run.sh $(dpkg --print-architecture) sid
-Depends: debian-archive-keyring, debvm, curl, file, openssh-client, seabios [ppc64el]
-Restrictions: allow-stderr, needs-internet, needs-root, flaky
+Test-Command: ./tests/create-and-run.sh $(dpkg --print-architecture) ""
+Depends: debian-archive-keyring, debvm, file, openssh-client, seabios [ppc64el]
+Restrictions: allow-stderr, needs-internet, needs-root
# Skip running on armel and armhf as the emulation is too slow there to actually work.
Architecture: amd64 arm64 i386 mips64el mipsel ppc64el riscv64 s390x
-Test-Command: unshare -U -m -p -f -r --mount-proc true || exit 77; ./tests/create-and-run.sh $(dpkg --print-architecture) sid
-Depends: debian-archive-keyring, debvm, curl, file, openssh-client, seabios [ppc64el], uidmap
-Restrictions: allow-stderr, needs-internet, skippable, flaky
+Test-Command: unshare -U -m -p -f -r --mount-proc true || exit 77; ./tests/create-and-run.sh $(dpkg --print-architecture) ""
+Depends: debian-archive-keyring, debvm, file, openssh-client, seabios [ppc64el], uidmap
+Restrictions: allow-stderr, needs-internet, skippable
# Skip running on armel and armhf as the emulation is too slow there to actually work.
Architecture: amd64 arm64 i386 mips64el mipsel ppc64el riscv64 s390x
diff --git a/tests/create-and-run.sh b/tests/create-and-run.sh
index 26fe4f7..1f164b9 100755
--- a/tests/create-and-run.sh
+++ b/tests/create-and-run.sh
@@ -21,7 +21,7 @@ trap cleanup EXIT INT TERM QUIT
ssh-keygen -f "$SSH_KEYPATH" -N ''
MIRROR=
-if ! curl -s "http://deb.debian.org/debian/dists/$RELEASE/InRelease" | sed -n 's/^Architectures: //p' | grep -qw "$ARCHITECTURE"; then
+if test -n "$RELEASE" && ! curl -s "http://deb.debian.org/debian/dists/$RELEASE/InRelease" | sed -n 's/^Architectures: //p' | grep -qw "$ARCHITECTURE"; then
MIRROR="deb [signed-by=/usr/share/keyrings/debian-ports-archive-keyring.gpg] http://deb.debian.org/debian-ports $RELEASE main"
fi
if test "$ARCHITECTURE" = armel; then
@@ -33,9 +33,23 @@ case "$RELEASE" in
MIRROR=http://archive.debian.org/debian
;;
esac
-set -- --architectures="$ARCHITECTURE"
-test -n "$MIRROR" && set -- "$@" "$MIRROR"
-debvm-create -k "$SSH_KEYPATH.pub" -o "$IMAGE" -r "$RELEASE" -- "$@"
+set -- -- --architectures="$ARCHITECTURE"
+if test -z "$RELEASE"; then
+ # The ordering of maybe-merged-usr and
+ # copy-host-apt-sources-and-preferences is unfortunately the wrong way
+ # round. Therefore, we make debvm-create skip it and pass it ourselves.
+ # The final empty string is the mirror specification.
+ set -- \
+ --skip=usrmerge \
+ "$@" \
+ --hook-dir=/usr/share/mmdebstrap/hooks/copy-host-apt-sources-and-preferences \
+ --hook-dir=/usr/share/mmdebstrap/hooks/file-mirror-automount \
+ --hook-dir=/usr/share/mmdebstrap/hooks/maybe-merged-usr \
+ ""
+elif test -n "$MIRROR"; then
+ set -- "$@" "$MIRROR"
+fi
+debvm-create -k "$SSH_KEYPATH.pub" -o "$IMAGE" -r "$RELEASE" "$@"
SSH_PORT=2222
timeout 300s debvm-run -s "$SSH_PORT" -i "$IMAGE" &