Source: libstrophe Version: 0.10.1-1 Severity: minor Tags: patch Hello,
I've attached a patch that adds two autopkgtests to the package. One is very simple and checks that the as-installed examples can be compiled, but doesn't run them. The other test installs Prosody, configures it to enable in-band registration, and creates and deletes a user. Although the code may be a little bit more ugly, I think it's worth it for a test that tests a server as well. I ran both tests under QEMU and they pass as-is for the unstable and experimental packages. -- System Information: Debian Release: bullseye/sid APT prefers testing APT policy: (500, 'testing'), (2, 'unstable'), (1, 'testing-debug'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.10.0-5-amd64 (SMP w/2 CPU threads) Kernel taint flags: TAINT_USER, TAINT_FIRMWARE_WORKAROUND Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
From 25ba9e3e1e4e2ca55bae2a86b0d7cdc39546f01d Mon Sep 17 00:00:00 2001 From: John Scott <[email protected]> Date: Sat, 10 Apr 2021 12:38:10 -0400 Subject: [PATCH] Add two superficial DEP-8 tests to test the installed package. --- debian/changelog | 9 +++++++++ debian/tests/build-examples | 5 +++++ debian/tests/control | 7 +++++++ debian/tests/in-band-registration | 28 ++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100755 debian/tests/build-examples create mode 100644 debian/tests/control create mode 100755 debian/tests/in-band-registration diff --git a/debian/changelog b/debian/changelog index b4318ae..2399a2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +libstrophe (0.11.0~git20210323.d7a28f9-2) UNRELEASED; urgency=medium + + [ John Scott ] + * Add two superficial DEP-8 tests to test the installed package: + - check that the installed examples can be compiled + - try making a user using in-band registration on a local server + + -- Debian XMPP Maintainers <[email protected]> Sat, 10 Apr 2021 12:36:29 -0400 + libstrophe (0.11.0~git20210323.d7a28f9-1) experimental; urgency=medium * Team upload diff --git a/debian/tests/build-examples b/debian/tests/build-examples new file mode 100755 index 0000000..115ed22 --- /dev/null +++ b/debian/tests/build-examples @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +cd "$AUTOPKGTEST_TMP" +find /usr/share/doc/libstrophe-dev/examples -name '*.c' -exec \ + sh -c 'gcc {} $(pkg-config --cflags --libs libstrophe) -o $(basename {} .c)' \; diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..3cd62c9 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,7 @@ +Tests: build-examples +Depends: libstrophe-dev, gcc, pkg-config +Restrictions: superficial + +Tests: in-band-registration +Depends: libstrophe-dev, gcc, pkg-config, prosody +Restrictions: isolation-container, needs-root, superficial diff --git a/debian/tests/in-band-registration b/debian/tests/in-band-registration new file mode 100755 index 0000000..aa3f62d --- /dev/null +++ b/debian/tests/in-band-registration @@ -0,0 +1,28 @@ +#!/bin/sh +set -e + +# Allow in-band registration +sed -i 's/allow_registration.*$/allow_registration = true/' /etc/prosody/prosody.cfg.lua + +# We're probably using an auto-generated self-signed certificate; don't require that clients trust it. +sed -i 's/c2s_require_encryption.*$/c2s_require_encryption = false/' /etc/prosody/prosody.cfg.lua +prosodyctl check config +systemctl restart prosody + +cd "$AUTOPKGTEST_TMP" +cp /usr/share/doc/libstrophe-dev/examples/register.c . + +# Delete the block that tries TLS; it may not be trusted. +sed -i '/child = xmpp_stanza_get_child_by_name(stanza, "starttls")/,/}/d' register.c + +gcc register.c -o register $(pkg-config --cflags --libs libstrophe) +printf "foo\nbar\n" | (./register foo@localhost 2>&1) + +prosodyctl deluser foo@localhost + +# As an assertion check, let's validate that trying to delete a non-existent user returns failure. +prosodyctl deluser nonexistent@localhost || EXITSTAT=$? +if [ "$EXITSTAT" = "0" ] +then + exit 1 +fi -- 2.30.2
signature.asc
Description: This is a digitally signed message part

