Package: libreswan
Version: 3.32-3
Severity: important
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu groovy ubuntu-patch

Dear Maintainer,

Depending on the builder being used it is not possible to reach the
internet, making, e.g. opportunistic, tests to fail. This patch makes
opportunistic and cavp tests skippable and makes it exit 77 in case of
failure, as specified by:
https://salsa.debian.org/ci-team/autopkgtest/blob/master/doc/README.package-tests.rst

In Ubuntu, the attached patch was applied to achieve the following:

  * d/tests/control: make opportunistic and cavp skippable if builder
    doesn't have access to internet.
  * d/tests/opportunistic: if ping or wget fails then exit 77 to skip
    the test.
  * d/tests/cavp: if wget fails then exit 77 to skip the test.


Thanks for considering the patch.


-- System Information:
Debian Release: buster/sid
  APT prefers bionic-updates
  APT policy: (500, 'bionic-updates'), (500, 'bionic-security'), (500, 
'bionic'), (100, 'bionic-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 5.4.0-42-generic (SMP w/12 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru libreswan-3.32/debian/tests/cavp libreswan-3.32/debian/tests/cavp
--- libreswan-3.32/debian/tests/cavp    2020-05-26 17:54:36.000000000 -0300
+++ libreswan-3.32/debian/tests/cavp    2020-08-26 16:07:30.000000000 -0300
@@ -15,7 +15,7 @@
 workdir=$(mktemp -d)
 cd "$workdir"
 
-wget --quiet 
https://download.libreswan.org/cavs/{ikev1_dsa,ikev1_psk,ikev2}.fax.bz2
+wget --quiet 
https://download.libreswan.org/cavs/{ikev1_dsa,ikev1_psk,ikev2}.fax.bz2 || exit 
77
 bunzip2 *.fax.bz2
 
 "$cavp" -v2 ikev2.fax | diff -u ikev2.fax - > /dev/null
diff -Nru libreswan-3.32/debian/tests/control 
libreswan-3.32/debian/tests/control
--- libreswan-3.32/debian/tests/control 2020-05-28 09:13:33.000000000 -0300
+++ libreswan-3.32/debian/tests/control 2020-08-26 16:07:46.000000000 -0300
@@ -1,5 +1,5 @@
 Tests: opportunistic
-Restrictions: needs-root, isolation-machine, needs-internet
+Restrictions: needs-root, isolation-machine, needs-internet, skippable
 Depends:
  dnsutils,
  iputils-ping,
@@ -14,7 +14,7 @@
  @,
 
 Tests: cavp
-Restrictions: needs-internet, allow-stderr
+Restrictions: needs-internet, allow-stderr, skippable
 Depends:
  bzip2,
  ca-certificates,
diff -Nru libreswan-3.32/debian/tests/opportunistic 
libreswan-3.32/debian/tests/opportunistic
--- libreswan-3.32/debian/tests/opportunistic   2020-05-26 17:51:07.000000000 
-0300
+++ libreswan-3.32/debian/tests/opportunistic   2020-08-26 16:08:34.000000000 
-0300
@@ -5,11 +5,11 @@
 
 badstring='<HTML><BODY><HEAD><TITLE>OH noooooos!!</TITLE>'
 
-ping -c 5 oe.libreswan.org 2>&1
+ping -c 5 oe.libreswan.org 2>&1 || exit 77
 
-dig +short -x  `dig +short oe.libreswan.org` ipseckey 
+trusted-key=/usr/share/dns/root.key +sigchase
+dig +short -x  `dig +short oe.libreswan.org` ipseckey 
+trusted-key=/usr/share/dns/root.key +sigchase || exit 77
 
-wget -q --tries=2 --timeout=5 -O "${AUTOPKGTEST_ARTIFACTS}/before.html" 
http://oe.libreswan.org/ 
+wget -q --tries=2 --timeout=5 -O "${AUTOPKGTEST_ARTIFACTS}/before.html" 
http://oe.libreswan.org/ || exit 77
 
 grep -F "$badstring" "${AUTOPKGTEST_ARTIFACTS}/before.html"
 
@@ -30,12 +30,12 @@
 # TODO: better details?
 ipsec whack --trafficstatus
 
-ping -c 5 oe.libreswan.org 2>&1
+ping -c 5 oe.libreswan.org 2>&1 || exit 77
 
 systemctl --no-pager status ipsec
 
 # now fetch some stuff from oe.libreswan.org, make sure it's good!
-wget -q --tries=2 --timeout=5 -O "${AUTOPKGTEST_ARTIFACTS}/after.html" 
http://oe.libreswan.org/ 
+wget -q --tries=2 --timeout=5 -O "${AUTOPKGTEST_ARTIFACTS}/after.html" 
http://oe.libreswan.org/ || exit 77
 
 if grep -F "$badstring" "${AUTOPKGTEST_ARTIFACTS}/after.html"; then
     printf "we got 'oh nooooooos' from http://oe.libreswan.org after bringing 
up opportunistic ipsec\n"

Reply via email to