I've spruced up the patch a little bit and and made it work on systems
not running systemd. The new patch which may be applied with 'git am'
to debian/experimental is attached
From a0ec674ae155d4e4596078f286e4f2c29e3aca27 Mon Sep 17 00:00:00 2001
From: John Scott <jsc...@posteo.net>
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 | 27 +++++++++++++++++++++++++++
 4 files changed, 48 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..6f661b1 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 <pkg-xmpp-de...@lists.alioth.debian.org>  Sun, 20 Jun 2021 14:41:49 -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..75a2684
--- /dev/null
+++ b/debian/tests/in-band-registration
@@ -0,0 +1,27 @@
+#!/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
+service prosody restart
+
+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 2>&1 || FAILED=1
+if [ "$FAILED" != "1" ]
+then exit 1
+fi
-- 
2.30.2

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to