Hello,
Ludovic Courtès <l...@gnu.org> writes: > Hi, > > Maxim Cournoyer <maxim.courno...@gmail.com> skribis: > >> Yes, that would be the correct and general solution (I hope you get to >> fix it, else I may look into it in some time). Workarounds currently in >> use can be seen in our mutter package definition (it's a bit convoluted, >> having to fork a process in which we set the child reaping property and >> invoke the test suite via tini, acting as a fake PID 1). > > The Guile process running the build script (with the build phases) runs > as PID 1. So how about doing one of these: > > 1. Add a final phase that does (waitpid WAIT_ANY). > > 2. Add a SIGCHLD handler that calls ‘waitpid’. > > I suspect the former is enough. I don't think it is, unless I'm misunderstanding something. The testsuite expects the daemon to die within a few seconds of sending it the quit command (which it does several times over the course of a number of the tests), so having it reaped at the end of the build process won't help. I tried the latter a couple of weeks ago and it didn't work either, though it's highly likely that I did something wrong in my Scheme code. I also didn't use the 1-second timer hack so perhaps that was it. I just tested this (adapted from the mutter package) and it worked: --8<---------------cut here---------------start------------->8--- @@ -4137,6 +4142,26 @@ (define-public public-inbox ;; the builder. (substitute* "t/httpd-unix.t" (("^SKIP: \\{") "SKIP: { skip('Guix');")))) + (replace 'check + (lambda* (#:key target + (tests? (not target)) (test-flags '()) + #:allow-other-keys) + (if tests? + (match (primitive-fork) + (0 ;child process + (set-child-subreaper!) + ;; 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. + (apply execlp "tini" "--" + "make" "check" test-flags)) + (pid + (match (waitpid pid) + ((_ . status) + (unless (zero? status) + (error "`./Build test' exited with status" status)))))) + (format #t "test suite not run~%")))) (add-after 'install 'wrap-programs (lambda* (#:key inputs outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) --8<---------------cut here---------------end--------------->8--- > Eventually, we should do one of these in gnu-build-system.scm, as in: > > https://issues.guix.gnu.org/30948#2 > > WDYT? I agree, possibly with the 1-second timer hack as well. -- Thanks Thiago