From 3ad59e1abe22d07ed93080f9307bb3f73129d9ec Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 10 Nov 2024 23:55:39 +0000 Subject: [PATCH] Add an autopkgtest --- debian/changelog | 1 + debian/tests/control | 3 +++ debian/tests/socat | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 debian/tests/control create mode 100755 debian/tests/socat diff --git a/debian/changelog b/debian/changelog index c4a09d0..1d3e276 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 index 0000000..e65e962 --- /dev/null +++ b/debian/tests/control @@ -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 index 0000000..82ca7f5 --- /dev/null +++ b/debian/tests/socat @@ -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