• Adding autopkgtests to GNU packages

    From Santiago Vila@21:1/5 to All on Thu Nov 28 12:50:01 2024
    Dear mentors:

    Many GNU packages have built-in tests that test the just-built programs.

    Is there a general procedure/trick/idiom to modify them so that they test
    the installed version instead? (so that they can be reused with minimal changes).

    (I'd like to do this for several packages without reinventing the wheel).

    Thanks.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Santiago Ruano =?iso-8859-1?Q?Rinc=@21:1/5 to All on Thu Nov 28 13:40:01 2024
    Hey tocayo,

    El 28/11/24 a las 12:43, Santiago Vila escribi≤:
    Dear mentors:

    Many GNU packages have built-in tests that test the just-built programs.

    Is there a general procedure/trick/idiom to modify them so that they test
    the installed version instead? (so that they can be reused with minimal changes).

    (I'd like to do this for several packages without reinventing the wheel).

    This is what grep does [0]:

    #!/bin/sh
    set -e

    export DEB_BUILD_PROFILES="nocheck nodoc" DEB_BUILD_OPTIONS="nocheck nodoc"

    dpkg-source --before-build `pwd`
    dpkg-buildpackage -rfakeroot --target=clean
    dpkg-buildpackage -rfakeroot --target=build

    make -C tests check-am

    [0] https://salsa.debian.org/debian/grep/-/blob/9f6e70143249f6c92fb7158a74d288332e132df4/debian/tests/upstream-test-suite

    HTH,

    -- Santiago

    -----BEGIN PGP SIGNATURE-----

    iHUEABYIAB0WIQR+lHTq7mkJOyB6t2Un3j1FEEiG7wUCZ0hiVwAKCRAn3j1FEEiG 7+pLAQC1WYayPsLVv6/4V7YcgkqLknxZ+hRrEy4I1SYQ/IMs0gD+IBQqVygTkxKk YQDGQDNGXMN1HYrAGsvQDXyNz06QJAE=
    =BzTM
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeroen Ploemen@21:1/5 to Santiago Vila on Thu Nov 28 18:50:01 2024
    On Thu, 28 Nov 2024 12:43:05 +0100
    Santiago Vila <sanvila@debian.org> wrote:

    Dear mentors:

    Many GNU packages have built-in tests that test the just-built
    programs.

    Is there a general procedure/trick/idiom to modify them so that
    they test the installed version instead? (so that they can be
    reused with minimal changes).

    What often works well with simple utils is creating a symlink
    pointing to the packaged binary, in whatever location the testsuite
    expects the freshly build one (typically the build root).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Guillem Jover@21:1/5 to All on Wed Dec 18 02:10:01 2024
    Hi!

    On Thu, 2024-11-28 at 09:30:15 -0300, Santiago Ruano Rincón wrote:
    This is what grep does [0]:

    #!/bin/sh
    set -e

    export DEB_BUILD_PROFILES="nocheck nodoc" DEB_BUILD_OPTIONS="nocheck nodoc"

    dpkg-source --before-build `pwd`

    Nit: I'd probably use «$(pwd)» here, or perhaps simply «.». :)

    dpkg-buildpackage -rfakeroot --target=clean
    dpkg-buildpackage -rfakeroot --target=build

    You should not need to pass -rfakeroot, which has been the default,
    if available, since dpkg 1.14.7 (from 2007-10).

    make -C tests check-am

    Is this really testing the installed executables? The convention is
    for the «check» target to use the built binaries for the tests. If you
    had only configured the package (instead of a full build), and the test
    suite would not hardcode program pathnames, then I assume that might
    implicitly test the installed binaries, but the above looks like might
    not be doing what is expected?

    Thanks,
    Guillem

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Guillem Jover@21:1/5 to Santiago Vila on Wed Dec 18 02:00:02 2024
    Hi!

    [ Perhaps you already managed to solve this, but just in case. :) ]

    On Thu, 2024-11-28 at 12:43:05 +0100, Santiago Vila wrote:
    Many GNU packages have built-in tests that test the just-built programs.

    Is there a general procedure/trick/idiom to modify them so that they test
    the installed version instead? (so that they can be reused with minimal changes).

    With autotools, there is infrastructure for running the test suite but
    using the installed binaries in the form of the «installcheck» target.
    This might need explicit support in the build system, so you'd need to
    check whether that is the case for each of these upstreams. If it is
    not, then you could perhaps either ask upstream to add it or provide
    a patch (it should in general not be be complicated).

    See for example in dpkg, the upstream part in the files:

    src/Makefile.am (installcheck-local)
    build-aux/autotest.am (autotest-installcheck)

    And the autopkgtest usage in for example:

    debian/tests/test-not-root

    Thanks,
    Guillem

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)