Hi Wouter,

I am continuing the off-topic part below. Earlier, in this discussion I
noted that being able to distinguish testing and unstable is rarely the
right thing to do. I'll use your nbd example to show why. Everyone not
interested in nbd autopktests may stop reading here.

On Sun, Aug 04, 2024 at 08:02:37PM +0200, Wouter Verhelst wrote:
> This is off-topic for the ctte discussion, but: this part of the
> autopkgtest is about testing the initrd scripts in the nbd package,
> which you can only do by booting a VM image. This requires us to
> generate something that can be booted over an NBD connection, which we
> do by way of "debvm-create" (whose implementation uses debootstrap).
> We then export this generated image through the nbd server that is
> installed in the testbed, and then use "debvm-run" to boot the image
> over NBD.

I note that an early version of the debvm autopkgtest worked the same
way until Paul kindly sat down with me and explained to me why I am
doing it wrong.

> This is very much a corner case, but *in order* for me to test what the
> testbed provides, I need to know what it is, exactly, that it is
> providing, and that does not appear to be in the autopkgtest API beyond
> the "use what is installed", and that just doesn't work when I need to
> generate a bootable image.

It does work! It's not exactly what the testbed provides that we need,
but the testbed's apt configuration (i.e. its sources and its apt pins).

> Perhaps if autopkgtest were to pass debootstrap arguments to be used for
> creation of a chroot if the test requires it, then I could stop using my
> script, but in the mean time...

Thankfully, Johannes turned those arguments into a mmdebstrap hook and
all you get to do is pass

    -hook-dir=/usr/share/mmdebstrap/hooks/copy-host-apt-sources-and-preferences

to mmdebstrap (or debvm-create as a pass-through option). No, this does
not work with debootstrap, because debootstrap does not use apt for
dependency resolution and presently has no way of using the configured
apt pins.  In theory, it should be possible to construct an apt
repository containing the packages as pinned in autopkgtest, but no such
thing exists as of now. So as long as you accept that you cannot do such
testing using debootstrap and have to use mmdebstrap, you're good. Your
mirror specification should be an empty string (""). Consider reading
the debvm or mmdebstrap autopkgtests for details.

I see that you already are using the hook and all you get to do now is
pass an empty suite and profit. Untested sketch:

--- a/debian/tests/initrd-boot
+++ b/debian/tests/initrd-boot
@@ -7,13 +7,6 @@
 # of our VM image below)
 chmod a+rx "$TMPDIR"

-source /etc/os-release
-
-if [ -z "$VERSION_ID" ]; then
-    RELEASE=$(perl debian/tests/get-deb-codename.pl)
-else
-    RELEASE="${VERSION_CODENAME:-unstable}"
-fi
 eval "$(grep "^ID=" /etc/os-release)"
 if [ "$ID" = "ubuntu" ]; then
     COMPONENTS=main,universe
@@ -34,7 +27,7 @@
 IMAGE="$TMPDIR"/nbd.img
 debvm-create \
     --output="$IMAGE" \
-    --release="$RELEASE" \
+    --release="" \
     --size=4G \
     --sshkey="$TMPDIR"/id_rsa.pub \
     --skip=usrmerge \
@@ -47,6 +40,7 @@
     --include="$INCLUDES${INCLUDES+,}nbd-client" \
     --components="$COMPONENTS" \
     $EXTRAS
+    ""

 # Configure and start up the nbd-server pointing at the new VM image
 cat > "$TMPDIR"/myvm.conf << EOF

Helmut

Reply via email to