Package: hello
Version: 2.10-1+deb9u1
Severity: wishlist
Tags: patch

In the spirit of having the hello package be a good example for new
maintainers, it would be nice for it to have (very simple) automated
as-installed test coverage that is picked up by infrastructure like
ci.debian.net. Lintian is now encouraging maintainers to add
autopkgtest metadata and it would be useful to be able to point to
hello as an easy example to copy from, in the same way it provides an
easy example for using dh.

I attach a patch, which is about as small as it can be while still
demonstrating both the Tests and Test-Command styles of declaring tests.

You can test this test (if you see what I mean) from a hello source
tree with, for example,

    autopkgtest -B . -- null

(requires autopkgtest and hello), or with

    sadt --verbose

(requires devscripts and python3-debian).

Regards,
    S
    accidentally writing autopkgtests at DebConf 17
>From f46e957b741cf7cce314eddfdcaa53b6190a3543 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 9 Aug 2017 21:45:14 -0400
Subject: [PATCH] Add a very basic autopkgtest

---
 debian/tests/control               | 5 +++++
 debian/tests/it-prints-the-message | 7 +++++++
 2 files changed, 12 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100755 debian/tests/it-prints-the-message

diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..5138fc3
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,5 @@
+Test-Command: hello
+Depends: hello
+
+Tests: it-prints-the-message
+Depends: @
diff --git a/debian/tests/it-prints-the-message b/debian/tests/it-prints-the-message
new file mode 100755
index 0000000..e9b47ea
--- /dev/null
+++ b/debian/tests/it-prints-the-message
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+message=`LC_ALL=C hello`
+echo "This should be a friendly greeting: '$message'"
+test "$message" = "Hello, world!"
-- 
2.13.3

Reply via email to