GNU bug report logs - #55954
[PATCH] gnu: public-inbox: Fixes to allow the testsuite to run

Previous Next

Package: guix-patches;

Reported by: Thiago Jung Bauermann <bauermann <at> kolabnow.com>

Date: Tue, 14 Jun 2022 03:33:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 55954 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
Cc: 55954 <at> debbugs.gnu.org
Subject: Re: bug#55954: [PATCH] gnu: public-inbox: Fixes to allow the
 testsuite to run
Date: Thu, 16 Jun 2022 11:27:44 +0200
Hi,

Thiago Jung Bauermann <bauermann <at> kolabnow.com> skribis:

> This patch makes the public-inbox testsuite pass. Some tests are skipped,
> so the test coverage could likely be increased with more massaging.
>
> Perhaps the most significant change is using tini to run the testsuite so
> that the testsuite's sub-processes are reaped. The ‘check’ phase is based on
> the one from the mutter package. Thanks to Maxim Cournoyer for pointing out
> this solution.
>
> * gnu/packages/patches/public-inbox-fix-spawn-test.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add new patch.
> * gnu/packages/mail.scm (public-inbox)[source]: Add new patch.
> [arguments]<#:tests?>: Remove argument.
> <#:imported-modules>: Add argument.
> <#:modules>: Likewise.
> <#:phases>{qualify-paths}: Substitute path for ‘/bin/cp’.
> {pre-check}: Don't skip httpd-unix.t test.  Remove unnecessary path
> substitutions for “env” and “/bin/sh”.
> {check}: Replace with custom version that launches the tests under tini.
> [native-inputs]: Add tini.

Applied, thanks!


[...]

> +         (replace 'check
> +           (lambda* (#:key target
> +                     (tests? (not target)) (test-flags '())
> +                     #:allow-other-keys)
> +             (if tests?
> +                 (match (primitive-fork)
> +                   (0                     ;child process
> +                    ;; lei tests build UNIX domain sockets in the temporary
> +                    ;; directory, but the path of those sockets can be at most
> +                    ;; 108 chars and Guix' default value for the variables
> +                    ;; below already use 47 chars. Use the shortest temporary
> +                    ;; path possible to avoid hitting the limit.
> +                    (setenv "TEMP" "/tmp")
> +                    (setenv "TEMPDIR" "/tmp")
> +                    (setenv "TMP" "/tmp")
> +                    (setenv "TMPDIR" "/tmp")
> +
> +                    ;; Use tini so that signals are properly handled and
> +                    ;; doubly-forked processes get reaped; otherwise,
> +                    ;; lei-daemon is kept as a zombie and the testsuite
> +                    ;; fails thinking that it didn't quit as it should.
> +                    (set-child-subreaper!)
> +                    (apply execlp "tini" "--"
> +                           "make" "check" test-flags))
> +                   (pid
> +                    (match (waitpid pid)
> +                      ((_ . status)
> +                       (unless (zero? status)
> +                         (error "`make check' exited with status" status))))))

It’s a bummer that we have to do all this.  Would this work:

  (replace 'check
    (lambda _
      (sigaction SIGINT SIG_DFL)
      (sigaction SIGTERM SIG_DFL)
      (sigaction SIGCHLD (lambda _ (waitpid WAIT_ANY WNOHANG)))

      ;; Ugly hack to make sure signal handler asyncs get a chance
      ;; to run while we’re in ‘waitpid’ during the “make check”
      ;; invocation.
      (sigaction SIGALRM (lambda _ (alarm 1)))
      (alarm 1)))

?

If not, the solution you propose LGTM.

Thanks,
Ludo’.




This bug report was last modified 3 years and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.