New DEP8 and build-time tests
Replaces: !6 (closed)
Hi,
as a result of including WireGuard in Ubuntu main, the MIR team requested [1] that we add some more tests to the package. Specifically DEP8 and build-time.
This is what I would be adding to the Ubuntu wireguard
package.
This is a rebased and improved version of !6 (closed)
- use
isolation-container
to allow running in DebCI/LXC containers - add
iputils-ping
test-dependency forwg-quick
DEP8 test - accept
nocheck
profile inoverride_dh_auto_test-arch
-
wireguard-tools.lintian-overrides
: Drop obsolete & fix broken context of tags
I ran the tests in a Debian testing LXC container, and they passed:
slyon@debci:~/wireguard$ sudo autopkgtest -B -U . -- lxc autopkgtest-testing-amd64
[...]
autopkgtest [18:02:29]: testbed running kernel: Linux 6.1.0-27-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.115-1 (2024-11-01)
autopkgtest [18:02:29]: @@@@@@@@@@@@@@@@@@@@ unbuilt-tree .
dpkg-source: info: using patch list from debian/patches/series
dpkg-source: info: applying 0001-Avoid-using-git-during-build.patch
dpkg-source: info: applying 0002-Avoid-requiring-glibc-2.25-for-wireguard-tools.patch
autopkgtest [18:02:33]: testing package wireguard version 1.0.20210914-1.1
autopkgtest [18:02:33]: build not needed
autopkgtest [18:02:33]: test keygen: preparing testbed
Reading package lists...
Building dependency tree...
Reading state information...
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following NEW packages will be installed:
wireguard-tools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 84.6 kB of archives.
After this operation, 329 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian testing/main amd64 wireguard-tools amd64 1.0.20210914-1.1 [84.6 kB]
Fetched 84.6 kB in 1s (98.7 kB/s)
Selecting previously unselected package wireguard-tools.
(Reading database ... 12175 files and directories currently installed.)
Preparing to unpack .../wireguard-tools_1.0.20210914-1.1_amd64.deb ...
Unpacking wireguard-tools (1.0.20210914-1.1) ...
Setting up wireguard-tools (1.0.20210914-1.1) ...
wg-quick.target is a disabled or a static unit, not starting it.
autopkgtest [18:02:40]: test keygen: [-----------------------
autopkgtest [18:02:40]: test keygen: -----------------------]
autopkgtest [18:02:41]: test keygen: - - - - - - - - - - results - - - - - - - - - -
keygen PASS (superficial)
autopkgtest [18:02:41]: test wg-quick: preparing testbed
Reading package lists...
Building dependency tree...
Reading state information...
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following NEW packages will be installed:
cpio dracut-install initramfs-tools initramfs-tools-core iputils-ping klibc-utils kmod libklibc libkmod2 linux-base
linux-image-6.12.6-rt-amd64 linux-image-rt-amd64 udev wireguard
0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 109 MB of archives.
After this operation, 124 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian testing/main amd64 cpio amd64 2.15+dfsg-2 [252 kB]
Get:2 http://deb.debian.org/debian testing/main amd64 iputils-ping amd64 3:20240905-1 [50.5 kB]
Get:3 http://deb.debian.org/debian testing/main amd64 libkmod2 amd64 33+20240816-2 [63.1 kB]
Get:4 http://deb.debian.org/debian testing/main amd64 kmod amd64 33+20240816-2 [95.6 kB]
Get:5 http://deb.debian.org/debian testing/main amd64 udev amd64 257.1-7 [1,929 kB]
Get:6 http://deb.debian.org/debian testing/main amd64 dracut-install amd64 105-3 [36.9 kB]
Get:7 http://deb.debian.org/debian testing/main amd64 libklibc amd64 2.0.13-4 [44.5 kB]
Get:8 http://deb.debian.org/debian testing/main amd64 klibc-utils amd64 2.0.13-4 [95.0 kB]
Get:9 http://deb.debian.org/debian testing/main amd64 initramfs-tools-core all 0.145 [49.2 kB]
Get:10 http://deb.debian.org/debian testing/main amd64 linux-base all 4.11 [31.2 kB]
Get:11 http://deb.debian.org/debian testing/main amd64 initramfs-tools all 0.145 [14.9 kB]
Get:12 http://deb.debian.org/debian testing/main amd64 linux-image-6.12.6-rt-amd64 amd64 6.12.6-1 [106 MB]
Get:13 http://deb.debian.org/debian testing/main amd64 linux-image-rt-amd64 amd64 6.12.6-1 [1,460 B]
Get:14 http://deb.debian.org/debian testing/main amd64 wireguard all 1.0.20210914-1.1 [5,472 B]
Fetched 109 MB in 9s (12.5 MB/s)
Preconfiguring packages ...
Selecting previously unselected package cpio.
(Reading database ... 12250 files and directories currently installed.)
Preparing to unpack .../00-cpio_2.15+dfsg-2_amd64.deb ...
Unpacking cpio (2.15+dfsg-2) ...
Selecting previously unselected package iputils-ping.
Preparing to unpack .../01-iputils-ping_3%3a20240905-1_amd64.deb ...
Unpacking iputils-ping (3:20240905-1) ...
Selecting previously unselected package libkmod2:amd64.
Preparing to unpack .../02-libkmod2_33+20240816-2_amd64.deb ...
Unpacking libkmod2:amd64 (33+20240816-2) ...
Selecting previously unselected package kmod.
Preparing to unpack .../03-kmod_33+20240816-2_amd64.deb ...
Unpacking kmod (33+20240816-2) ...
Selecting previously unselected package udev.
Preparing to unpack .../04-udev_257.1-7_amd64.deb ...
Unpacking udev (257.1-7) ...
Selecting previously unselected package dracut-install.
Preparing to unpack .../05-dracut-install_105-3_amd64.deb ...
Unpacking dracut-install (105-3) ...
Selecting previously unselected package libklibc:amd64.
Preparing to unpack .../06-libklibc_2.0.13-4_amd64.deb ...
Unpacking libklibc:amd64 (2.0.13-4) ...
Selecting previously unselected package klibc-utils.
Preparing to unpack .../07-klibc-utils_2.0.13-4_amd64.deb ...
Unpacking klibc-utils (2.0.13-4) ...
Selecting previously unselected package initramfs-tools-core.
Preparing to unpack .../08-initramfs-tools-core_0.145_all.deb ...
Unpacking initramfs-tools-core (0.145) ...
Selecting previously unselected package linux-base.
Preparing to unpack .../09-linux-base_4.11_all.deb ...
Unpacking linux-base (4.11) ...
Selecting previously unselected package initramfs-tools.
Preparing to unpack .../10-initramfs-tools_0.145_all.deb ...
Unpacking initramfs-tools (0.145) ...
Selecting previously unselected package linux-image-6.12.6-rt-amd64.
Preparing to unpack .../11-linux-image-6.12.6-rt-amd64_6.12.6-1_amd64.deb ...
Unpacking linux-image-6.12.6-rt-amd64 (6.12.6-1) ...
Selecting previously unselected package linux-image-rt-amd64.
Preparing to unpack .../12-linux-image-rt-amd64_6.12.6-1_amd64.deb ...
Unpacking linux-image-rt-amd64 (6.12.6-1) ...
Selecting previously unselected package wireguard.
Preparing to unpack .../13-wireguard_1.0.20210914-1.1_all.deb ...
Unpacking wireguard (1.0.20210914-1.1) ...
Setting up cpio (2.15+dfsg-2) ...
update-alternatives: using /usr/bin/mt-gnu to provide /usr/bin/mt (mt) in auto mode
Setting up linux-base (4.11) ...
Setting up libklibc:amd64 (2.0.13-4) ...
Setting up klibc-utils (2.0.13-4) ...
No diversion 'diversion of /usr/share/initramfs-tools/hooks/klibc to /usr/share/initramfs-tools/hooks/klibc^i-t by klibc-utils', none removed.
Setting up iputils-ping (3:20240905-1) ...
Setting up libkmod2:amd64 (33+20240816-2) ...
Setting up kmod (33+20240816-2) ...
sed: can't read /etc/modules: No such file or directory
Setting up udev (257.1-7) ...
Creating group 'input' with GID 997.
Creating group 'sgx' with GID 996.
Creating group 'kvm' with GID 995.
Creating group 'render' with GID 994.
systemd-udevd.service is a disabled or a static unit, not starting it.
Setting up dracut-install (105-3) ...
Setting up initramfs-tools-core (0.145) ...
Setting up initramfs-tools (0.145) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-6.12.6-rt-amd64 (6.12.6-1) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-6.12.6-rt-amd64
I: /initrd.img.old is now a symlink to boot/initrd.img-6.12.6-rt-amd64
I: /vmlinuz is now a symlink to boot/vmlinuz-6.12.6-rt-amd64
I: /initrd.img is now a symlink to boot/initrd.img-6.12.6-rt-amd64
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.12.6-rt-amd64
W: No zstd in /usr/bin:/sbin:/bin, using gzip
Setting up linux-image-rt-amd64 (6.12.6-1) ...
Setting up wireguard (1.0.20210914-1.1) ...
Processing triggers for libc-bin (2.40-5) ...
Processing triggers for initramfs-tools (0.145) ...
update-initramfs: Generating /boot/initrd.img-6.12.6-rt-amd64
W: No zstd in /usr/bin:/sbin:/bin, using gzip
autopkgtest [18:04:29]: test wg-quick: [-----------------------
Setting things up
Generating keys
Generating wireguard config
Cleaning up old namespaces
Creating new namespaces left_ns and right_ns and adding loopback interface to them
Creating veth interface connecting both namespaces
Bringing up LEFT wireguard interface in namespace left_ns
[#] ip link add wg_left type wireguard
[#] wg setconf wg_left /dev/fd/63
[#] ip -4 address add 10.0.5.1/24 dev wg_left
[#] ip link set mtu 1420 up dev wg_left
Bringing up RIGHT wireguard interface in namespace right_ns
[#] ip link add wg_right type wireguard
[#] wg setconf wg_right /dev/fd/63
[#] ip -4 address add 10.0.5.2/24 dev wg_right
[#] ip link set mtu 1420 up dev wg_right
This is the config
left_ns namespace:
[Interface]
ListenPort = 3001
PrivateKey = KK7mSx0s6hoDfIpK3XSm9P1iq6tC0Xph2cj3+K7Ajmc=
[Peer]
PublicKey = dSM0eRlQdqs6BOSv1oq2kqB7QezL5b+D+504HOklD0A=
AllowedIPs = 10.0.5.2/32
Endpoint = 10.0.1.2:3002
right_ns namespace:
[Interface]
ListenPort = 3002
PrivateKey = mPo/NGkkYRVhzTGaBXtB9dTJOZJSvEO7SLBHMG0O8Ew=
[Peer]
PublicKey = IXWzfKEQ59OzLDS+V/UBRXJZA/7gwqMNObcajcHR4mU=
AllowedIPs = 10.0.5.1/32
Endpoint = 10.0.1.1:3001
Testing gateway ping
Pinging right gateway, from left_ns namespace
PING 10.0.5.2 (10.0.5.2) 56(84) bytes of data.
64 bytes from 10.0.5.2: icmp_seq=1 ttl=64 time=1.90 ms
--- 10.0.5.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.901/1.901/1.901/0.000 ms
Pinging left gateway, from right_ns namespace
PING 10.0.5.1 (10.0.5.1) 56(84) bytes of data.
64 bytes from 10.0.5.1: icmp_seq=1 ttl=64 time=0.274 ms
--- 10.0.5.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.274/0.274/0.274/0.000 ms
Testing wireguard interface ping
Pinging right wireguard IP from left_ns namespace
PING 10.0.1.2 (10.0.1.2) 56(84) bytes of data.
64 bytes from 10.0.1.2: icmp_seq=1 ttl=64 time=0.100 ms
--- 10.0.1.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.100/0.100/0.100/0.000 ms
Pinging left wireguard IP from right_ns namesapce
PING 10.0.1.1 (10.0.1.1) 56(84) bytes of data.
64 bytes from 10.0.1.1: icmp_seq=1 ttl=64 time=0.059 ms
--- 10.0.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.059/0.059/0.059/0.000 ms
Testing vpn stats
Namespace left_ns
latest handshake: Now
transfer: 348 B received, 404 B sent
Namespace right_ns
latest handshake: Now
transfer: 404 B received, 348 B sent
autopkgtest [18:04:31]: test wg-quick: -----------------------]
autopkgtest [18:04:31]: test wg-quick: - - - - - - - - - - results - - - - - - - - - -
wg-quick PASS
autopkgtest [18:04:31]: test netns-mini: preparing testbed
Reading package lists...
Building dependency tree...
Reading state information...
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
autopkgtest [18:04:35]: test netns-mini: [-----------------------
[+] ip netns add wg-test-16040-0
[+] ip netns add wg-test-16040-1
[+] ip netns add wg-test-16040-2
[+] NS0: ip link set up dev lo
[+] NS0: ip link add dev wg0 type wireguard
[+] NS0: ip link set wg0 netns wg-test-16040-1
[+] NS0: ip link add dev wg0 type wireguard
[+] NS0: ip link set wg0 netns wg-test-16040-2
[+] NS1: ip addr add 192.168.241.1/24 dev wg0
[+] NS2: ip addr add 192.168.241.2/24 dev wg0
[+] wg genkey
[+] wg genkey
[+] wg pubkey
[+] wg pubkey
[+] NS1: wg set wg0 private-key /dev/fd/63 listen-port 1 peer EC3uowkJ984RNKKVclVX+/8La++htlXYIKsWF0JzAEA= allowed-ips 192.168.241.2/32
[+] NS2: wg set wg0 private-key /dev/fd/63 listen-port 2 peer +lyStCxCuoquGmRgcf4mzqnkEL6/MWli4JSSyNY97UQ= allowed-ips 192.168.241.1/32
[+] NS1: ip link set up dev wg0
[+] NS2: ip link set up dev wg0
[+] NS2: wg set wg0 peer +lyStCxCuoquGmRgcf4mzqnkEL6/MWli4JSSyNY97UQ= endpoint 127.0.0.1:1
[+] NS2: ping -c 10 -f -W 1 192.168.241.1
PING 192.168.241.1 (192.168.241.1) 56(84) bytes of data.
--- 192.168.241.1 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 8ms
rtt min/avg/max/mdev = 0.076/0.259/1.879/0.539 ms, ipg/ewma 0.922/0.620 ms
[+] NS0: ip link del dev wg0
[+] NS1: ip link del dev wg0
[+] NS2: ip link del dev wg0
[+] ip netns del wg-test-16040-1
[+] ip netns del wg-test-16040-2
[+] ip netns del wg-test-16040-0
autopkgtest [18:04:36]: test netns-mini: -----------------------]
autopkgtest [18:04:37]: test netns-mini: - - - - - - - - - - results - - - - - - - - - -
netns-mini PASS
autopkgtest [18:04:37]: @@@@@@@@@@@@@@@@@@@@ summary
keygen PASS (superficial)
wg-quick PASS
netns-mini PASS
Edited by Lukas Märdian