Source: duktape
Version: 2.7.0-2
Severity: wishlist
Tags: patch

It's easy for the packaging of a shared library and its -dev package to go
wrong in a way that breaks dependent packages, and adding a superficial
autopkgtest that is run before upload can catch surprisingly many of
those situations. I think each -dev package in Debian would ideally have
one of these compile/link/run tests.

In the case of duktape, I've confirmed that running the attached test
against binaries from 2.7.0-1 fails (reproducing #1031801), while running
it against 2.7.0-2 succeeds.

Also available as a merge request:
https://salsa.debian.org/debian-iot-team/duktape/-/merge_requests/3

    smcv
>From ac5bb02d919f9d0bca7273c0ec9e3577094e1380 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Sun, 12 Mar 2023 23:17:39 +0000
Subject: [PATCH] d/tests/duktape-dev: Add an automated smoke-test for the -dev
 package

Reproduces: #1031801
---
 debian/tests/control     |  6 ++++++
 debian/tests/duktape-dev | 28 ++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100755 debian/tests/duktape-dev

diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..46fa50a
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,6 @@
+Tests: duktape-dev
+Restrictions: allow-stderr, superficial
+Depends:
+ build-essential,
+ duktape-dev,
+ pkg-config,
diff --git a/debian/tests/duktape-dev b/debian/tests/duktape-dev
new file mode 100755
index 0000000..418912f
--- /dev/null
+++ b/debian/tests/duktape-dev
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Copyright 2023 Simon McVittie
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+if [ -n "${AUTOPKGTEST_TMP-}" ]; then
+	WORKDIR="$AUTOPKGTEST_TMP"
+else
+	WORKDIR="$(mktemp -d)"
+	trap 'cd /; rm -fr "$WORKDIR"' 0 INT QUIT ABRT PIPE TERM
+fi
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+    CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+    CROSS_COMPILE=
+fi
+
+cp examples/hello/hello.c "$WORKDIR"
+
+cd "$WORKDIR"
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+"${CROSS_COMPILE}gcc" -ohello hello.c $("${CROSS_COMPILE}pkg-config" --cflags --libs duktape)
+
+./hello
-- 
2.39.2

Reply via email to