all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thiago Jung Bauermann via Guix-patches via <guix-patches@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 55954@debbugs.gnu.org
Subject: [bug#55954] [PATCH] gnu: public-inbox: Fixes to allow the testsuite to run
Date: Thu, 16 Jun 2022 23:38:50 -0300	[thread overview]
Message-ID: <87bkushu4v.fsf@kolabnow.com> (raw)
In-Reply-To: <87a6adlzzj.fsf@gnu.org>


Hello Ludo,

Thank you for your review!

Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Thiago Jung Bauermann <bauermann@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!

I guess you had second thoughts. :-)

>> +         (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)))
>
> ?

I assume there should be a "make check" in there somewhere. :-)

Unfortunately, it didn't work. This is the check phase I tried:

--8<---------------cut here---------------start------------->8---
  (replace 'check
    (lambda _
      (setenv "TEMP" "/tmp")
      (setenv "TEMPDIR" "/tmp")
      (setenv "TMP" "/tmp")
      (setenv "TMPDIR" "/tmp")

      (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)
      (unless (zero? (status:exit-val (system* "make" "check")))
        (error "`make check' exited with error"))))
--8<---------------cut here---------------end--------------->8---

And this was the end of the output of the phase:

--8<---------------cut here---------------start------------->8---
    ⋮
Bailout called.  Further testing stopped:  daemon still running (PID:5282)
FAILED--Further testing stopped: daemon still running (PID:5282)
make: *** [Makefile:4141: check-each] Error 255
error: in phase 'check': uncaught exception:
misc-error #f "~A" ("`make check' exited with error") #f
phase `check' failed after 27.7 seconds
--8<---------------cut here---------------end--------------->8---

“daemon still running” means that lei's daemon process wasn't reaped.

> If not, the solution you propose LGTM.

Thanks. Hopefully this can be fixed in Guix's build machinery itself in
the core-updates branch and all the packages that are using this hack
can drop it then.

-- 
Thanks
Thiago




  reply	other threads:[~2022-06-17  3:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14  3:32 [bug#55954] [PATCH] gnu: public-inbox: Fixes to allow the testsuite to run Thiago Jung Bauermann via Guix-patches via
2022-06-16  9:27 ` Ludovic Courtès
2022-06-17  2:38   ` Thiago Jung Bauermann via Guix-patches via [this message]
2022-06-17 12:44     ` bug#55954: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkushu4v.fsf@kolabnow.com \
    --to=guix-patches@gnu.org \
    --cc=55954@debbugs.gnu.org \
    --cc=bauermann@kolabnow.com \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.