unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Jeremy Evans <jeremyevans0@gmail.com>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: Fix hang when running tests on OpenBSD by skipping two tests
Date: Tue, 15 Nov 2011 21:03:49 +0100	[thread overview]
Message-ID: <CADGZSSe0CUn2nW5zzSh=Da4HO7F7OX7zu+CWEhE7v=cU2J1Gng@mail.gmail.com> (raw)
In-Reply-To: <20111115031744.GA3666@dcvr.yhbt.net>

On Tue, Nov 15, 2011 at 4:17 AM, Eric Wong <normalperson@yhbt.net> wrote:
> I usually prefer to work on each problem, one-at-a-time.  However,
> GNU make already has a handy -k/--keep-going flag to ignore failures.

Thanks, I didn't know about that, and it is much easier than patching
make files.

I think I've fixed all the issues that caused test failures on
OpenBSD.  All changes are in the test code itself.  Hope this helps.
Sorry if gmail mangles these diffs.

Thanks,
Jeremy

expr on OpenBSD uses a basic regular expression (according to
re_format(7)), which doesn't support +, only *.

--- t/t0011-active-unix-socket.sh.orig  Tue Nov 15 20:28:37 2011
+++ t/t0011-active-unix-socket.sh       Tue Nov 15 20:28:54 2011
@@ -7,7 +7,7 @@ read_pid_unix () {
            socat - UNIX:$unix_socket | \
            tail -1)
        test -n "$x"
-       y="$(expr "$x" : '\([0-9]\+\)')"
+       y="$(expr "$x" : '\([0-9][0-9]*\)')"
        test x"$x" = x"$y"
        test -n "$y"
        echo "$y"

I assume you aren't purposely testing a large timeout here, so
hopefully this change is fine.  The original code caused an infinite
loop on OpenBSD, and also taking up all available space on the file
system if you let it run long enough because it wrote to the log
inside the loop.  On 1.8.7:

E, [2011-11-15T18:55:34.616397 #11092] ERROR -- : master loop error:
time + 2147483646.000000 out of Time range (RangeError)
E, [2011-11-15T18:55:34.616538 #11092] ERROR -- :
/usr/obj/ports/unicorn-4.1.1/unicorn-4.1.1/t/../test/ruby-1.8.7/lib/unicorn/http_server.rb:264:in
`+'
E, [2011-11-15T18:55:34.616611 #11092] ERROR -- :
/usr/obj/ports/unicorn-4.1.1/unicorn-4.1.1/t/../test/ruby-1.8.7/lib/unicorn/http_server.rb:264:in
`join'
E, [2011-11-15T18:55:34.616686 #11092] ERROR -- :
/usr/obj/ports/unicorn-4.1.1/unicorn-4.1.1/t/../test/ruby-1.8.7/bin/unicorn:121

On 1.9.3:

E, [2011-11-15T19:00:20.464234 #13442] ERROR -- : listen loop error:
Invalid argument (Errno::EINVAL)
E, [2011-11-15T19:00:20.464327 #13442] ERROR -- :
/usr/local/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:620:in
`select'
E, [2011-11-15T19:00:20.464399 #13442] ERROR -- :
/usr/local/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:620:in
`worker_loop'
E, [2011-11-15T19:00:20.464457 #13442] ERROR -- :
/usr/local/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:485:in
`spawn_missing_workers'
E, [2011-11-15T19:00:20.464514 #13442] ERROR -- :
/usr/local/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:135:in
`start'
E, [2011-11-15T19:00:20.464570 #13442] ERROR -- :
/usr/local/lib/ruby/gems/1.8/gems/unicorn-4.1.1/bin/unicorn:121
E, [2011-11-15T19:00:20.464626 #13442] ERROR -- :
/usr/local/bin/unicorn:19:in `load'
E, [2011-11-15T19:00:20.464681 #13442] ERROR -- : /usr/local/bin/unicorn:19

--- t/t0012-reload-empty-config.sh.orig Tue Nov 15 20:05:13 2011
+++ t/t0012-reload-empty-config.sh      Tue Nov 15 20:05:37 2011
@@ -9,7 +9,7 @@ t_begin "setup and start" && {
        cat >> $unicorn_config <<EOF
 logger Logger.new(STDOUT)
 preload_app true
-timeout 0x7fffffff
+timeout 0x7fffff
 worker_processes 2
 after_fork { |s,w| }
 \$dump_cfg = lambda { |fp,srv|

openssl sha1 on OpenBSD doesn't just spit out the hash:

$ openssl sha1 mocha.diff
SHA1(mocha.diff)= 4ea47d3cf9e4f1858a298a8a9f5a5671422971d5
$ sha1 -q mocha.diff
4ea47d3cf9e4f1858a298a8a9f5a5671422971d5

--- t/test-lib.sh.orig  Tue Nov 15 19:12:25 2011
+++ t/test-lib.sh       Tue Nov 15 19:38:05 2011
@@ -101,6 +101,7 @@ unicorn_wait_start () {

 rsha1 () {
        _cmd="$(which sha1sum 2>/dev/null || :)"
+       test -n "$_cmd" || _cmd="$(which sha1 2>/dev/null || :) -q"
        test -n "$_cmd" || _cmd="$(which openssl 2>/dev/null || :) sha1"
        test "$_cmd" != " sha1" || _cmd="$(which gsha1sum 2>/dev/null || :)"

You can listen on 0.0.0.0, but trying to connect to it doesn't work
well on OpenBSD.

--- test/test_helper.rb.orig    Tue Nov 15 20:43:39 2011
+++ test/test_helper.rb Tue Nov 15 20:46:17 2011
@@ -72,6 +72,7 @@ def hit(uris)
     res = nil

     if u.kind_of? String
+      u = 'http://127.0.0.1:8080/' if u == 'http://0.0.0.0:8080/'
       res = Net::HTTP.get(URI.parse(u))
     else
       url = URI.parse(u[0])
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

  reply	other threads:[~2011-11-15 21:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-14 19:33 Fix hang when running tests on OpenBSD by skipping two tests Jeremy Evans
2011-11-14 20:54 ` Eric Wong
2011-11-14 23:46   ` Jeremy Evans
2011-11-15  3:17     ` Eric Wong
2011-11-15 20:03       ` Jeremy Evans [this message]
2011-11-15 21:19         ` Jeremy Evans
2011-11-15 22:36         ` Eric Wong
2011-11-16  1:18         ` Eric Wong

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

  List information: https://yhbt.net/unicorn/

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

  git send-email \
    --in-reply-to='CADGZSSe0CUn2nW5zzSh=Da4HO7F7OX7zu+CWEhE7v=cU2J1Gng@mail.gmail.com' \
    --to=jeremyevans0@gmail.com \
    --cc=mongrel-unicorn@rubyforge.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 public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).