From c63eb6291986dd813a74e76fdccf06900669c957 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 24 Sep 2023 19:39:33 +0200 Subject: 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. --- tests/create-and-run.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'tests') 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" & -- cgit v1.2.3