* [PATCH] gnu: dmd: Sleep longer in tests, for slower machines @ 2014-02-16 7:33 Mark H Weaver 2014-02-16 21:16 ` Ludovic Courtès 0 siblings, 1 reply; 5+ messages in thread From: Mark H Weaver @ 2014-02-16 7:33 UTC (permalink / raw) To: guix-devel [-- Attachment #1: Type: text/plain, Size: 77 bytes --] I need this to successfully pass the dmd tests on the YeeLoong. Mark [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: [PATCH] gnu: dmd: Sleep longer in tests, for slower machines --] [-- Type: text/x-patch, Size: 3699 bytes --] From d964bc6f49eba2ba2eed6481aa0a0ceb6dfbd4e5 Mon Sep 17 00:00:00 2001 From: Mark H Weaver <mhw@netris.org> Date: Sun, 16 Feb 2014 02:23:18 -0500 Subject: [PATCH] gnu: dmd: Sleep longer in tests, for slower machines. * gnu/packages/patches/dmd-tests-longer-sleeps.patch: New file. * gnu/packages/admin.scm (dmd): Add the patch. * gnu-system.am (dist_patch_DATA): Add it. --- gnu-system.am | 1 + gnu/packages/admin.scm | 3 +- gnu/packages/patches/dmd-tests-longer-sleeps.patch | 52 ++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/dmd-tests-longer-sleeps.patch diff --git a/gnu-system.am b/gnu-system.am index a745b33..4db1cba 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -246,6 +246,7 @@ dist_patch_DATA = \ gnu/packages/patches/dbus-localstatedir.patch \ gnu/packages/patches/diffutils-gets-undeclared.patch \ gnu/packages/patches/dmd-getpw.patch \ + gnu/packages/patches/dmd-tests-longer-sleeps.patch \ gnu/packages/patches/emacs-configure-sh.patch \ gnu/packages/patches/findutils-absolute-paths.patch \ gnu/packages/patches/flac-fix-memcmp-not-declared.patch \ diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 928d752..6998996 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -49,7 +49,8 @@ (sha256 (base32 "07mddw0p62fcphwjzgb6rfa0pjz5sy6jzbha0sm2vc3rqf459jxg")) - (patches (list (search-patch "dmd-getpw.patch"))))) + (patches (list (search-patch "dmd-getpw.patch") + (search-patch "dmd-tests-longer-sleeps.patch"))))) (build-system gnu-build-system) (arguments '(#:configure-flags '("--localstatedir=/var"))) diff --git a/gnu/packages/patches/dmd-tests-longer-sleeps.patch b/gnu/packages/patches/dmd-tests-longer-sleeps.patch new file mode 100644 index 0000000..708000f --- /dev/null +++ b/gnu/packages/patches/dmd-tests-longer-sleeps.patch @@ -0,0 +1,52 @@ +Increase sleep times in tests, for slower machines. + +Patch by Mark H Weaver <mhw@netris.org>. + +--- dmd/tests/basic.sh 2013-11-30 17:22:00.000000000 -0500 ++++ dmd/tests/basic.sh 2014-02-16 02:18:34.036376953 -0500 +@@ -46,7 +46,7 @@ + dmd -I -s "$socket" -c "$conf" -l "$log" & + dmd_pid=$! + +-sleep 1 # XXX: wait till it's up ++sleep 3 # XXX: wait till it's up + kill -0 $dmd_pid + test -S "$socket" + $deco status dmd | grep -E '(Start.*dmd|Stop.*test)' +--- dmd/tests/respawn.sh 2013-12-01 16:50:37.000000000 -0500 ++++ dmd/tests/respawn.sh 2014-02-16 02:19:16.958251953 -0500 +@@ -39,7 +39,7 @@ + i=0 + while ! test -f "$1" && test $i -lt 20 + do +- sleep 0.3 ++ sleep 1 + i=`expr $i + 1` + done + test -f "$1" +@@ -65,14 +65,14 @@ + #:provides '(test1) + #:start (make-forkexec-constructor + "$SHELL" "-c" +- "echo \$\$ > $service1_pid ; while true ; do sleep 1 ; done") ++ "echo \$\$ > $service1_pid ; while true ; do sleep 3 ; done") + #:stop (make-kill-destructor) + #:respawn? #t) + (make <service> + #:provides '(test2) + #:start (make-forkexec-constructor + "$SHELL" "-c" +- "echo \$\$ > $service2_pid ; while true ; do sleep 1 ; done") ++ "echo \$\$ > $service2_pid ; while true ; do sleep 3 ; done") + #:stop (make-kill-destructor) + #:respawn? #t)) + (start 'test1) +@@ -82,7 +82,7 @@ + dmd -I -s "$socket" -c "$conf" -l "$log" & + dmd_pid=$! + +-sleep 1 # XXX: wait till it's up ++sleep 3 # XXX: wait till it's up + kill -0 $dmd_pid + test -S "$socket" + $deco status test1 | grep started -- 1.8.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gnu: dmd: Sleep longer in tests, for slower machines 2014-02-16 7:33 [PATCH] gnu: dmd: Sleep longer in tests, for slower machines Mark H Weaver @ 2014-02-16 21:16 ` Ludovic Courtès 2014-02-17 9:01 ` Andreas Enge 0 siblings, 1 reply; 5+ messages in thread From: Ludovic Courtès @ 2014-02-16 21:16 UTC (permalink / raw) To: Mark H Weaver; +Cc: guix-devel Mark H Weaver <mhw@netris.org> skribis: > I need this to successfully pass the dmd tests on the YeeLoong. Damn, this machine is slow. ;-) I wonder what we could do to better handle that, though. Perhaps dmd could send SIGUSR1 to its parent when the socket’s ready, like Xorg does? > From d964bc6f49eba2ba2eed6481aa0a0ceb6dfbd4e5 Mon Sep 17 00:00:00 2001 > From: Mark H Weaver <mhw@netris.org> > Date: Sun, 16 Feb 2014 02:23:18 -0500 > Subject: [PATCH] gnu: dmd: Sleep longer in tests, for slower machines. > > * gnu/packages/patches/dmd-tests-longer-sleeps.patch: New file. > * gnu/packages/admin.scm (dmd): Add the patch. > * gnu-system.am (dist_patch_DATA): Add it. OK, please push. Thanks, Ludo’. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gnu: dmd: Sleep longer in tests, for slower machines 2014-02-16 21:16 ` Ludovic Courtès @ 2014-02-17 9:01 ` Andreas Enge 2014-02-17 13:04 ` Mark H Weaver 0 siblings, 1 reply; 5+ messages in thread From: Andreas Enge @ 2014-02-17 9:01 UTC (permalink / raw) To: Ludovic Courtès; +Cc: guix-devel It looks like the patch broke dmd on i686 and x86_64: http://hydra.gnu.org/eval/52352 Andreas ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gnu: dmd: Sleep longer in tests, for slower machines 2014-02-17 9:01 ` Andreas Enge @ 2014-02-17 13:04 ` Mark H Weaver 2014-02-18 16:49 ` Ludovic Courtès 0 siblings, 1 reply; 5+ messages in thread From: Mark H Weaver @ 2014-02-17 13:04 UTC (permalink / raw) To: Andreas Enge; +Cc: guix-devel Andreas Enge <andreas@enge.fr> writes: > It looks like the patch broke dmd on i686 and x86_64: > http://hydra.gnu.org/eval/52352 Wow, those tests must be very fragile. All I did was increase all of the sleep times by a factor of about 3. I didn't look closely at the logic. Mark ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gnu: dmd: Sleep longer in tests, for slower machines 2014-02-17 13:04 ` Mark H Weaver @ 2014-02-18 16:49 ` Ludovic Courtès 0 siblings, 0 replies; 5+ messages in thread From: Ludovic Courtès @ 2014-02-18 16:49 UTC (permalink / raw) To: Mark H Weaver; +Cc: guix-devel [-- Attachment #1: Type: text/plain, Size: 441 bytes --] Mark H Weaver <mhw@netris.org> skribis: > Andreas Enge <andreas@enge.fr> writes: >> It looks like the patch broke dmd on i686 and x86_64: >> http://hydra.gnu.org/eval/52352 > > Wow, those tests must be very fragile. All I did was increase all of > the sleep times by a factor of about 3. I didn't look closely at the > logic. I think this is fixed by dmd commit 3c45967 (below), which I just pushed. Thanks, Ludo’. [-- Attachment #2: Type: text/x-patch, Size: 5686 bytes --] commit 3c459670690f90f85905d241d230a7541a41fe15 Author: Ludovic Courtès <ludo@gnu.org> Date: Tue Feb 18 15:10:28 2014 +0100 dmd: Add '--pid' option. * modules/dmd.scm (main): Add '--pid' option and honor it. * tests/basic.sh: Run dmd with '--pid'. Wait for the PID file to be available, for synchronization. * tests/respawn.sh: Likewise. * dmd.texi (Invoking dmd): Document '--pid'. Modified dmd.texi diff --git a/dmd.texi b/dmd.texi index a970894..f7306db 100644 --- a/dmd.texi +++ b/dmd.texi @@ -369,6 +369,10 @@ Log output into @var{file}, or if @var{file} is not given, @code{/var/log/dmd.log} when running as superuser, @var{~/.dmd.log} otherwise. +@item --pid[=@var{file}] +When dmd is ready to accept connections, write its PID to @var{file} or +to the standard output if @var{file} is omitted. + @item -p [@var{file}] @itemx --persistency[=@var{file}] @c FIXME-CRITICAL Modified modules/dmd.scm diff --git a/modules/dmd.scm b/modules/dmd.scm index df41eb3..bfa579f 100644 --- a/modules/dmd.scm +++ b/modules/dmd.scm @@ -1,5 +1,5 @@ ;; dmd.scm -- Daemon managing Daemons (or Daemons-managing Daemon?) -;; Copyright (C) 2013 Ludovic Courts <ludo@gnu.org> +;; Copyright (C) 2013, 2014 Ludovic Courts <ludo@gnu.org> ;; Copyright (C) 2002, 2003 Wolfgang Jhrling <wolfgang@pro-linux.de> ;; ;; This file is part of GNU dmd. @@ -23,6 +23,7 @@ #:use-module (ice-9 readline) ;; Readline (for interactive use). #:use-module (oop goops) ;; Defining classes and methods. #:use-module (srfi srfi-1) ;; List library. + #:use-module (srfi srfi-26) #:use-module (dmd config) #:use-module (dmd support) #:use-module (dmd service) @@ -54,6 +55,7 @@ (let ((config-file default-config-file) (socket-file default-socket-file) + (pid-file #f) (insecure #f) (logfile default-logfile)) ;; Process command line arguments. @@ -99,6 +101,12 @@ #:action (lambda (file) (set! logfile file))) (make <option> + #:long "pid" + #:takes-arg? #t #:optional-arg? #t #:arg-name "FILE" + #:description "when ready write PID to FILE or stdout" + #:action (lambda (file) + (set! pid-file (or file #t)))) + (make <option> #:long "config" #:short #\c #:takes-arg? #t #:optional-arg? #f #:arg-name "FILE" #:description "read configuration from FILE" @@ -173,6 +181,16 @@ ;; EINTR, which happens anytime we receive a signal, such as ;; SIGCHLD. Thus, wrap the 'accept' call. (accept (EINTR-safe accept))) + + ;; Possibly write out our PID, which means we're ready to accept + ;; connections. XXX: What if we daemonized already? + (match pid-file + ((? string? file) + (call-with-output-file pid-file + (cute display (getpid) <>))) + (#t (display (getpid))) + (_ #t)) + (let next-command () (match (accept sock) ((command-source . client-address) Modified tests/basic.sh diff --git a/tests/basic.sh b/tests/basic.sh index 0311f20..e9ad970 100644 --- a/tests/basic.sh +++ b/tests/basic.sh @@ -1,5 +1,5 @@ # GNU dmd --- Test basic communication capabilities. -# Copyright © 2013 Ludovic Courtès <ludo@gnu.org> +# Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org> # # This file is part of GNU dmd. # @@ -23,11 +23,12 @@ socket="t-socket-$$" conf="t-conf-$$" log="t-log-$$" stamp="t-stamp-$$" +pid="t-pid-$$" deco="deco -s $socket" -dmd_pid="" -trap "rm -f $socket $conf $stamp $log; test -z $dmd_pid || kill $dmd_pid" EXIT +trap "rm -f $socket $conf $stamp $log $pid; + test -f $pid && kill \`cat $pid\` || true" EXIT cat > "$conf"<<EOF (use-modules (srfi srfi-26)) @@ -43,10 +44,14 @@ cat > "$conf"<<EOF #:respawn? #f)) EOF -dmd -I -s "$socket" -c "$conf" -l "$log" & -dmd_pid=$! +rm -f "$pid" +dmd -I -s "$socket" -c "$conf" -l "$log" --pid="$pid" & + +# Wait till it's ready. +while ! test -f "$pid" ; do : ; done + +dmd_pid="`cat $pid`" -sleep 1 # XXX: wait till it's up kill -0 $dmd_pid test -S "$socket" $deco status dmd | grep -E '(Start.*dmd|Stop.*test)' Modified tests/respawn.sh diff --git a/tests/respawn.sh b/tests/respawn.sh index 96fad66..161eead 100644 --- a/tests/respawn.sh +++ b/tests/respawn.sh @@ -1,5 +1,5 @@ # GNU dmd --- Test respawnable services. -# Copyright © 2013 Ludovic Courtès <ludo@gnu.org> +# Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org> # # This file is part of GNU dmd. # @@ -25,11 +25,12 @@ log="t-log-$$" stamp="t-stamp-$$" service1_pid="t-service1-pid-$$" service2_pid="t-service2-pid-$$" +pid="t-pid-$$" deco="deco -s $socket" -dmd_pid="" -trap "rm -f $socket $conf $stamp $log; test -z $dmd_pid || kill $dmd_pid ; +trap "rm -f $socket $conf $stamp $log $pid $service1_pid $service2_pid ; + test -f $pid && kill \`cat $pid\` || true ; test -f $service1_pid && kill \`cat $service1_pid\` || true ; test -f $service2_pid && kill \`cat $service2_pid\` || true ; rm -f $service1_pid $service2_pid" EXIT @@ -79,10 +80,14 @@ cat > "$conf"<<EOF (start 'test2) EOF -dmd -I -s "$socket" -c "$conf" -l "$log" & -dmd_pid=$! +rm -f "$pid" +dmd -I -s "$socket" -c "$conf" -l "$log" --pid="$pid" & + +# Wait till it's ready. +wait_for_file "$pid" + +dmd_pid="`cat $pid`" -sleep 1 # XXX: wait till it's up kill -0 $dmd_pid test -S "$socket" $deco status test1 | grep started ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-18 16:49 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-02-16 7:33 [PATCH] gnu: dmd: Sleep longer in tests, for slower machines Mark H Weaver 2014-02-16 21:16 ` Ludovic Courtès 2014-02-17 9:01 ` Andreas Enge 2014-02-17 13:04 ` Mark H Weaver 2014-02-18 16:49 ` Ludovic Courtès
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.