diff -Nru libxcvt-0.1.1/debian/changelog libxcvt-0.1.1/debian/changelog --- libxcvt-0.1.1/debian/changelog 2022-02-10 13:49:36.000000000 +0000 +++ libxcvt-0.1.1/debian/changelog 2022-02-18 10:49:09.000000000 +0000 @@ -1,3 +1,9 @@ +libxcvt (0.1.1-3) unstable; urgency=medium + + * Add a simple autopkgtest that tests the lib is working. + + -- Timo Aaltonen Fri, 18 Feb 2022 12:49:09 +0200 + libxcvt (0.1.1-2) unstable; urgency=medium * rules: Override dh_missing, add --fail-.missing. diff -Nru libxcvt-0.1.1/debian/tests/build-test libxcvt-0.1.1/debian/tests/build-test --- libxcvt-0.1.1/debian/tests/build-test 1970-01-01 00:00:00.000000000 +0000 +++ libxcvt-0.1.1/debian/tests/build-test 2022-02-18 10:45:12.000000000 +0000 @@ -0,0 +1,80 @@ +#!/bin/sh +set -eu + +if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then + CROSS_COMPILE="$DEB_HOST_GNU_TYPE-" +else + CROSS_COMPILE= +fi + +cd "$AUTOPKGTEST_TMP" + +# stolen from cvt/cvt.c +# Copyright 2005-2006 Luc Verhaegen. +cat < libtest.c +#include +#include +#include +#include + +#include + +/* + * Originally grabbed from xf86Mode.c. + * + * Ignoring the actual mode_info->name, as the user will want something solid + * to grab hold of. + */ +static void +print_mode_line(struct libxcvt_mode_info *mode_info, int hdisplay, int vdisplay, float vrefresh, + bool reduced) +{ + if (reduced) + printf("Modeline \"%dx%dR\" ", hdisplay, vdisplay); + else + printf("Modeline \"%dx%d_%.2f\" ", hdisplay, vdisplay, vrefresh); + + printf("%6.2f %i %i %i %i %i %i %i %i", mode_info->dot_clock / 1000., + mode_info->hdisplay, mode_info->hsync_start, mode_info->hsync_end, mode_info->htotal, + mode_info->vdisplay, mode_info->vsync_start, mode_info->vsync_end, mode_info->vtotal); + + if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_INTERLACE) + printf(" interlace"); + if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_HSYNC_POSITIVE) + printf(" +hsync"); + if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_HSYNC_NEGATIVE) + printf(" -hsync"); + if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_VSYNC_POSITIVE) + printf(" +vsync"); + if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_VSYNC_NEGATIVE) + printf(" -vsync"); + + printf("\n"); +} + +int +main (int argc, char *argv[]) +{ + struct libxcvt_mode_info *mode_info; + int hdisplay = 1024, vdisplay = 768; + float vrefresh = 60.0; + bool reduced = false, verbose = false; + bool interlaced = false; + + mode_info = libxcvt_gen_mode_info(hdisplay, vdisplay, vrefresh, reduced, interlaced); + if (!mode_info) { + fprintf(stderr, "Out of memory!\n"); + return 0; + } + print_mode_line(mode_info, hdisplay, vdisplay, vrefresh, reduced); + free(mode_info); + + return 0; +} +EOF + +${CROSS_COMPILE}gcc -o libtest libtest.c $(${CROSS_COMPILE}pkg-config --cflags --libs libxcvt) +echo "build ok" +[ -x libtest ] +./libtest +echo "starts ok" diff -Nru libxcvt-0.1.1/debian/tests/control libxcvt-0.1.1/debian/tests/control --- libxcvt-0.1.1/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ libxcvt-0.1.1/debian/tests/control 2022-02-18 10:21:54.000000000 +0000 @@ -0,0 +1,6 @@ +Tests: build-test +Depends: libxcvt-dev, build-essential, pkg-config + +Test-Command: dh_auto_configure; dh_auto_build; dh_auto_test +Depends: @builddeps@ +Restrictions: allow-stderr