chiark / gitweb /
Add an autopkgtest
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Nov 2024 23:55:39 +0000 (23:55 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 11 Nov 2024 00:03:58 +0000 (00:03 +0000)
debian/changelog
debian/tests/control [new file with mode: 0644]
debian/tests/socat [new file with mode: 0755]

index c4a09d0c5f529d16926a1c1e9bab0a8e094031af..1d3e276ae389ff044063206cc6ce5075dab8459a 100644 (file)
@@ -12,6 +12,7 @@ authbind (2.2.0~) unstable; urgency=medium
   * Description: Mention LD_PRELOAD.  Closes: #949949.
   * d/control: Add `Vcs-*` headers.   [Niels Thykier]
   * Abolish the prerm and postinst (/usr/share transition).  Closes: #866249.
+  * Add an autopkgtest.
 
  --
 
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644 (file)
index 0000000..e65e962
--- /dev/null
@@ -0,0 +1,3 @@
+Depends: @, socat, chiark-really
+Restrictions: needs-root, skippable, allow-stderr
+Tests: socat
diff --git a/debian/tests/socat b/debian/tests/socat
new file mode 100755 (executable)
index 0000000..82ca7f5
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+set -ex
+
+if [ "x$AUTOPKGTEST_NORMAL_USER" = x ]; then
+    exit 77
+fi
+
+user=$AUTOPKGTEST_NORMAL_USER
+
+port=7
+addr='[::1]'
+token=cQFoveQKSgwPdcKQ
+touch /etc/authbind/byport/7
+chmod 544 /etc/authbind/byport/7
+chown "$user" /etc/authbind/byport/7
+
+really -u $user \
+authbind \
+socat "TCP6-LISTEN:$port,bind=$addr" "exec:echo $token" &
+
+pid=$!
+
+# Ideally we'd wait for socat to get its act together, but that's hard.
+sleep 5
+
+token_got=$(socat "TCP6:$addr:$port" STDIO </dev/null)
+
+test "x$token_got" = "x$token"
+wait $pid
+
+echo ok.