diff -Nru initramfs-tools-0.140ubuntu13.2/debian/changelog initramfs-tools-0.140ubuntu13.3/debian/changelog --- initramfs-tools-0.140ubuntu13.2/debian/changelog 2023-06-14 08:54:33.000000000 +0200 +++ initramfs-tools-0.140ubuntu13.3/debian/changelog 2023-07-13 13:12:19.000000000 +0200 @@ -1,3 +1,16 @@ +initramfs-tools (0.140ubuntu13.3) jammy; urgency=medium + + [ Loïc Minier ] + * Include kernel/drivers/usb/typec/ucsi with MODULES=most along with other + USB storage drivers; LP: #2027636. + + [ Benjamin Drung ] + * Port the net autopkgtest to the common test framework. This drops + depending on downloading a cloud image from the Internet and reduces + the execution time from 3:19 min down to 0:57 min. (LP: #2027575) + + -- Benjamin Drung Thu, 13 Jul 2023 13:12:19 +0200 + initramfs-tools (0.140ubuntu13.2) jammy; urgency=medium * Add char/hw_random drivers (LP: #1983359) diff -Nru initramfs-tools-0.140ubuntu13.2/debian/control initramfs-tools-0.140ubuntu13.3/debian/control --- initramfs-tools-0.140ubuntu13.2/debian/control 2022-02-08 20:54:47.000000000 +0100 +++ initramfs-tools-0.140ubuntu13.3/debian/control 2023-07-13 13:11:39.000000000 +0200 @@ -7,8 +7,8 @@ Build-Depends: debhelper-compat (= 12), bash-completion, shellcheck [!i386] , pkg-config, libudev-dev, netplan.io [!i386] Rules-Requires-Root: no Standards-Version: 4.1.5 -Vcs-Browser: https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/initramfs-tools/ -Vcs-Git: git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/initramfs-tools +Vcs-Browser: https://code.launchpad.net/~ubuntu-core-dev/ubuntu/+source/initramfs-tools/+git/initramfs-tools +Vcs-Git: https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/initramfs-tools -b ubuntu/jammy X-Debian-Vcs-Browser: https://salsa.debian.org/kernel-team/initramfs-tools X-Debian-Vcs-Git: https://salsa.debian.org/kernel-team/initramfs-tools.git diff -Nru initramfs-tools-0.140ubuntu13.2/debian/tests/amd64-net initramfs-tools-0.140ubuntu13.3/debian/tests/amd64-net --- initramfs-tools-0.140ubuntu13.2/debian/tests/amd64-net 1970-01-01 01:00:00.000000000 +0100 +++ initramfs-tools-0.140ubuntu13.3/debian/tests/amd64-net 2023-07-13 13:03:13.000000000 +0200 @@ -0,0 +1,88 @@ +#!/bin/sh +set -eu + +# Some simple tests of the initramfs network configuration. + +# The basic idea is to make an ext2 root image that only ships a /sbin/init to +# just gather some data and shutdown again and boot it in qemu system +# emulation (not KVM, so it can be run in the autopkgtest architecture without +# hoping nested kvm works). Currently it only sets up qemu user networking +# which limits our ability to be clever. In the long run we should set up a +# tun and a bridge and specify the mac address of the NICs in the emulated +# system and run dnsmasq on it so we test ipv6 and can control which ips which +# nics get and so on -- but this is still better than nothing. + +SUPPORTED_FLAVOURS='amd64 generic' +ROOTDISK_QEMU_IF=virtio +ROOTDISK_LINUX_NAME=vda +. debian/tests/test-common + +cat >>"${CONFDIR}/initramfs.conf" <"${CONFDIR}/modules" <"${ROOTDIR}/sbin/init" < str: + """Extract the command output from the given log output. -if 'dhclient' in ps_output: - error("dhclient appears to be running") + The output must be framed by a header and a footer line. The header + line contains the key surrounded by 10 # characters. The footer + line consist of 40 # characters. + """ + marker = "#" * 10 + footer = "#" * 40 + match = re.search( + f"^{marker} {re.escape(key)} {marker}\n(.*?\n){footer}$", + log, + flags=re.DOTALL | re.MULTILINE, + ) + if not match: + error(f"Block '{marker} {key} {marker}' not found in log output") + sys.exit(1) + return match.group(1) + + +log_file = sys.argv[1] +log = pathlib.Path(log_file).read_text(encoding="ascii") +addrs = json.loads(extract_from_log(log, "ip -json addr")) +links = json.loads(extract_from_log(log, "ip -json link")) +ps_output = extract_from_log(log, "ps aux") i = 2 while i < len(sys.argv): diff -Nru initramfs-tools-0.140ubuntu13.2/debian/tests/control initramfs-tools-0.140ubuntu13.3/debian/tests/control --- initramfs-tools-0.140ubuntu13.2/debian/tests/control 2022-02-08 20:54:47.000000000 +0100 +++ initramfs-tools-0.140ubuntu13.3/debian/tests/control 2023-07-13 12:45:40.000000000 +0200 @@ -26,17 +26,19 @@ Depends: @, qemu-system-x86, linux-image-amd64 | linux-image-generic:amd64, klibc-utils, genext2fs Restrictions: skip-not-installable, needs-root +Tests: amd64-net +Depends: cloud-initramfs-dyn-netconf, + genext2fs, + iproute2, + isc-dhcp-client, + klibc-utils, + linux-image-amd64 | linux-image-generic:amd64, + python3, + qemu-system-x86, + zstd, + @ +Restrictions: skip-not-installable, needs-root + Test-Command: ./tests/run-tests Depends: netplan.io Restrictions: allow-stderr - -Tests: net -Depends: curl, - initramfs-tools, - isc-dhcp-client, - linux-image-generic, - lsb-release, - parted, - python3, - qemu-system -Restrictions: needs-root, allow-stderr diff -Nru initramfs-tools-0.140ubuntu13.2/debian/tests/net initramfs-tools-0.140ubuntu13.3/debian/tests/net --- initramfs-tools-0.140ubuntu13.2/debian/tests/net 2022-02-08 20:54:47.000000000 +0100 +++ initramfs-tools-0.140ubuntu13.3/debian/tests/net 1970-01-01 01:00:00.000000000 +0100 @@ -1,60 +0,0 @@ -#!/bin/bash - -set -ux - -# Some simple tests of the initramfs network configuration. - -# The basic idea is to make an image that has /sbin/init overwritten -# to just gather some data and shutdown again and boot it in qemu -# system emulation (not KVM, so it can be run in the autopkgtest -# architecture without hoping nested kvm works). Currently it only -# sets up qemu user networking which limits our ability to be -# clever. In the long run we should set up a tun and a bridge and -# specify the mac address of the NICs in the emuilated system and run -# dnsmasq on it so we test ipv6 and can control which ips which nics -# get and so on -- but this is still better than nothing. - -# Also the current qemu command lines only work on intel. That should -# be fixed too :) - -arch=$(dpkg --print-architecture) -[ $arch = amd64 ] || [ $arch = i386 ] || exit 0 - - -./debian/tests/prep-image image.img -ret=$? -if [ $ret -eq 100 ]; then - # This indicates that a rootfs was not found (maybe very early - # in development for this cycle?), skip in this case. - exit 0 -elif [ $ret -ne 0 ]; then - exit $ret -fi -set -e - -basecmdline="root=UUID=$(cat image.img-uuid) rw console=ttyS0" - -mkinitramfs -o myinitrd - -nicslot=5 -nicname=ens$nicslot -kernel=$(echo /boot/vmlinu*-"$(uname -r)") - -run () { - ./debian/tests/run-image kernel=$kernel initrd=myinitrd \ - image=image.img cmdline="$basecmdline ${1-}" \ - output=result nicslot=$nicslot -} - -run "" -./debian/tests/check-results result has_no_ipv4_addr $nicname - -run "ip=dhcp" -./debian/tests/check-results result has_an_ipv4_addr $nicname - -run "ip=:::::$nicname:dhcp" -./debian/tests/check-results result has_an_ipv4_addr $nicname - -run "ip=10.0.2.100::10.0.2.2:255.0.0.0::$nicname:" -./debian/tests/check-results result has_ipv4_addr $nicname 10.0.2.100 - diff -Nru initramfs-tools-0.140ubuntu13.2/debian/tests/prep-image initramfs-tools-0.140ubuntu13.3/debian/tests/prep-image --- initramfs-tools-0.140ubuntu13.2/debian/tests/prep-image 2022-02-08 20:54:47.000000000 +0100 +++ initramfs-tools-0.140ubuntu13.3/debian/tests/prep-image 1970-01-01 01:00:00.000000000 +0100 @@ -1,56 +0,0 @@ -#!/bin/bash - -# prep-image $IMAGE preps an image for the tests. Specifically it: -# -# 1. downloads a cloud image rootfs -# 2. creates an image containing a single partition at $IMAGE, -# 3. writes the UUID of the partition to $IMAGE-uuid, -# 4. extracts the rootfs to the image, and -# 5. overwrites /sbin/init with a script that gathers some data to -# /result and shuts the machine down - -set -eux -IMAGE="$1" -series=$(lsb_release -sc) -url=http://cloud-images.ubuntu.com/$series/current/$series-server-cloudimg-$(dpkg --print-architecture)-root.tar.xz -filename=$(basename "$url") -mkdir -p images -if [ ! -f images/"$filename" ]; then - status=$(curl --silent --write-out "%{http_code}\n" --output images/"$filename" "$url") - if [ "$status" = 404 ]; then - exit 100 - fi -fi -rm -f "$IMAGE" "${IMAGE}-uuid" -truncate -s 2G "$IMAGE" -parted --script --align optimal "$IMAGE" -- mklabel gpt mkpart primary ext4 1MiB -2048s -dev="$(losetup -Pf --show "$IMAGE")" -partprobe -mke2fs -q "${dev}p1" -blkid --output=value "${dev}p1" | head -n1 > "${IMAGE}-uuid" -mkdir -p mnt -mount "${dev}p1" mnt -tar --xattrs-include=* -C mnt -xf images/"$filename" -rm -f mnt/sbin/init -cat > mnt/sbin/init << \EOF -#!/bin/sh -set -x -rm -rf /result -mkdir /result -# Run twice, once for the logs, once for the test harness -ip addr -ip link -for file in /run/net-*.conf /run/net6-*.conf; do - [ -f $file ] || continue; - cat $file - cp $file /result -done -ip -json addr > /result/addr.json -ip -json link > /result/link.json -ps aux | tee /result/ps.txt -sync -exec /lib/systemd/systemd-shutdown poweroff -EOF -chmod u+x mnt/sbin/init -umount mnt -losetup -d "$dev" diff -Nru initramfs-tools-0.140ubuntu13.2/debian/tests/run-image initramfs-tools-0.140ubuntu13.3/debian/tests/run-image --- initramfs-tools-0.140ubuntu13.2/debian/tests/run-image 2022-02-08 20:54:47.000000000 +0100 +++ initramfs-tools-0.140ubuntu13.3/debian/tests/run-image 1970-01-01 01:00:00.000000000 +0100 @@ -1,51 +0,0 @@ -#!/bin/bash - -set -eux - -NICSLOT=3 - -while [ $# -gt 0 ]; do - case $1 in - kernel=*) KERNEL="${1#kernel=}" ;; - initrd=*) INITRD="${1#initrd=}" ;; - image=*) IMAGE="${1#image=}" ;; - cmdline=*) CMDLINE="${1#cmdline=}" ;; - output=*) OUTPUT="${1#output=}" ;; - nicslot=*) NICSLOT="${1#nicslot=}" ;; - esac - shift -done - -archopts=() - -case $(uname -m) in -i?86) - qemu="qemu-system-i386" - ;; -ppc64*) - qemu="qemu-system-ppc64" - archopts=( -machine "pseries,usb=off" ) - ;; -aarch64) - qemu="qemu-system-aarch64" - archopts=( -machine "virt" ) - ;; -*) - qemu=qemu-system-$(uname -m) -esac - -timeout --foreground 10m \ - "$qemu" "${archopts[@]}" -m 512m \ - -kernel "$KERNEL" -initrd "$INITRD" \ - -append "$CMDLINE" \ - -drive file="$IMAGE",format=raw \ - -nographic -monitor none \ - -netdev user,id=net0 -device virtio-net-pci,netdev=net0,bus=pci.0,addr="$NICSLOT" - -dev=$(losetup -Pf --show "$IMAGE") -partprobe -mount "${dev}p1" mnt -rm -rf "$OUTPUT" -cp -aT mnt/result "$OUTPUT" -umount mnt -losetup -d "$dev" diff -Nru initramfs-tools-0.140ubuntu13.2/debian/tests/test-common initramfs-tools-0.140ubuntu13.3/debian/tests/test-common --- initramfs-tools-0.140ubuntu13.2/debian/tests/test-common 2022-02-08 20:54:47.000000000 +0100 +++ initramfs-tools-0.140ubuntu13.3/debian/tests/test-common 2023-07-13 12:45:40.000000000 +0200 @@ -1,5 +1,7 @@ # -*- mode: sh -*- +NICSLOT=5 + # Find kernel flavour and release KVER= for flavour in $SUPPORTED_FLAVOURS; do @@ -13,7 +15,7 @@ exit 2 fi -if [ -n "${AUTOPKGTEST_TMP}" ]; then +if [ -n "${AUTOPKGTEST_TMP-}" ]; then export TMPDIR="${AUTOPKGTEST_TMP}" fi @@ -37,9 +39,12 @@ # Create a root fs with a trivial userspace ROOTDIR="$(mktemp -d)" INIT_MESSAGE='root fs init system started successfully' -for subdir in bin dev lib proc run sbin sys usr usr/bin; do +for subdir in dev proc run sys usr usr/bin usr/lib usr/lib64 usr/sbin; do mkdir "${ROOTDIR}/${subdir}" done +for subdir in bin lib lib64 sbin; do + ln -s "usr/${subdir}" "${ROOTDIR}/${subdir}" +done cat >"${ROOTDIR}/sbin/init" <&2 "E: Message '${msg}' not found in log output '${OUTPUT}." + exit 1 + fi +} diff -Nru initramfs-tools-0.140ubuntu13.2/hook-functions initramfs-tools-0.140ubuntu13.3/hook-functions --- initramfs-tools-0.140ubuntu13.2/hook-functions 2023-06-14 08:54:33.000000000 +0200 +++ initramfs-tools-0.140ubuntu13.3/hook-functions 2023-07-13 12:19:23.000000000 +0200 @@ -665,6 +665,7 @@ copy_modules_dir kernel/drivers/usb/isp1760 copy_modules_dir kernel/drivers/usb/musb copy_modules_dir kernel/drivers/usb/renesas_usbhs + copy_modules_dir kernel/drivers/usb/typec/ucsi # and any extcon drivers for USB modules="$modules extcon-usb-gpio extcon-usbc-cros-ec" # Add the axp20x_usb_power power supply driver,