raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH 0/4] lighter tests + rack 3 dependency fix
@ 2023-12-29 17:50 Eric Wong
  2023-12-29 17:50 ` [PATCH 1/4] tests: support running tests without rack||aggregate Eric Wong
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eric Wong @ 2023-12-29 17:50 UTC (permalink / raw)
  To: raindrops-public

Some things I noticed while preparing a release in the wake of
Ruby 3.3.

Eric Wong (4):
  tests: support running tests without rack||aggregate
  test/test_last_data_recv: don't require posix_mq
  extconf: disable optimization to speed up checks by ~3%
  gemspec: support rack 3.x

 ext/raindrops/extconf.rb    |  2 ++
 raindrops.gemspec           |  2 +-
 test/rack_unicorn.rb        |  3 +--
 test/test_last_data_recv.rb | 16 +++++++++++++++-
 test/test_watcher.rb        |  4 ++--
 5 files changed, 21 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] tests: support running tests without rack||aggregate
  2023-12-29 17:50 [PATCH 0/4] lighter tests + rack 3 dependency fix Eric Wong
@ 2023-12-29 17:50 ` Eric Wong
  2023-12-29 17:50 ` [PATCH 2/4] test/test_last_data_recv: don't require posix_mq Eric Wong
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-12-29 17:50 UTC (permalink / raw)
  To: raindrops-public; +Cc: Eric Wong

From: Eric Wong <e@80x24.org>

Diskspace and bandwidth are expensive, and we can make
rack+aggregate optional in tests, too.
---
 test/rack_unicorn.rb        | 3 +--
 test/test_last_data_recv.rb | 8 +++++++-
 test/test_watcher.rb        | 4 ++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/test/rack_unicorn.rb b/test/rack_unicorn.rb
index 779e8bf..0ecbd42 100644
--- a/test/rack_unicorn.rb
+++ b/test/rack_unicorn.rb
@@ -1,11 +1,10 @@
 # -*- encoding: binary -*-
 require "test/unit"
 require "raindrops"
-require "rack"
-require "rack/lobster"
 require "open-uri"
 begin
   require "unicorn"
+  require "rack"
   require "rack/lobster"
 rescue LoadError => e
   warn "W: #{e} skipping test since Rack or Unicorn was not found"
diff --git a/test/test_last_data_recv.rb b/test/test_last_data_recv.rb
index ef84e05..b1a5ac6 100644
--- a/test/test_last_data_recv.rb
+++ b/test/test_last_data_recv.rb
@@ -1,3 +1,9 @@
+begin
+  require 'aggregate'
+  have_aggregate = true
+rescue LoadError => e
+  warn "W: #{e} skipping #{__FILE__}"
+end
 require 'test/unit'
 require 'raindrops'
 require 'io/wait'
@@ -40,4 +46,4 @@ def test_accept_nonblock_one
     assert_equal 1, s.raindrops_aggregate.size
     assert_raise(IO::WaitReadable) { s.accept_nonblock }
   end
-end if RUBY_PLATFORM =~ /linux/
+end if RUBY_PLATFORM =~ /linux/ && have_aggregate
diff --git a/test/test_watcher.rb b/test/test_watcher.rb
index 28ac49b..e5d1fa2 100644
--- a/test/test_watcher.rb
+++ b/test/test_watcher.rb
@@ -1,9 +1,9 @@
 # -*- encoding: binary -*-
 require "test/unit"
-require "rack"
 require "raindrops"
 begin
   require 'aggregate'
+  require 'rack'
 rescue LoadError => e
   warn "W: #{e} skipping #{__FILE__}"
 end
@@ -183,4 +183,4 @@ def test_peaks
     assert_equal queued_before, headers["X-Last-Peak-At"], "should not change"
     assert_equal start, headers["X-First-Peak-At"]
   end
-end if RUBY_PLATFORM =~ /linux/ && defined?(Aggregate)
+end if RUBY_PLATFORM =~ /linux/ && defined?(Aggregate) && defined?(Rack)

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] test/test_last_data_recv: don't require posix_mq
  2023-12-29 17:50 [PATCH 0/4] lighter tests + rack 3 dependency fix Eric Wong
  2023-12-29 17:50 ` [PATCH 1/4] tests: support running tests without rack||aggregate Eric Wong
@ 2023-12-29 17:50 ` Eric Wong
  2023-12-29 17:50 ` [PATCH 3/4] extconf: disable optimization to speed up checks by ~3% Eric Wong
  2023-12-29 17:50 ` [PATCH 4/4] gemspec: support rack 3.x Eric Wong
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-12-29 17:50 UTC (permalink / raw)
  To: raindrops-public

posix_mq is rarely installed, so don't force users to
have it in order to test or develop raindrops.
---
 test/test_last_data_recv.rb | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/test_last_data_recv.rb b/test/test_last_data_recv.rb
index b1a5ac6..9643dc6 100644
--- a/test/test_last_data_recv.rb
+++ b/test/test_last_data_recv.rb
@@ -9,6 +9,14 @@
 require 'io/wait'
 
 class TestLastDataRecv < Test::Unit::TestCase
+  def setup
+    Raindrops::Aggregate::LastDataRecv.default_aggregate = []
+  end
+
+  def teardown
+    Raindrops::Aggregate::LastDataRecv.default_aggregate = nil
+  end
+
   def test_accept_nonblock_agg
     s = Socket.new(:INET, :STREAM, 0)
     s.listen(128)

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] extconf: disable optimization to speed up checks by ~3%
  2023-12-29 17:50 [PATCH 0/4] lighter tests + rack 3 dependency fix Eric Wong
  2023-12-29 17:50 ` [PATCH 1/4] tests: support running tests without rack||aggregate Eric Wong
  2023-12-29 17:50 ` [PATCH 2/4] test/test_last_data_recv: don't require posix_mq Eric Wong
@ 2023-12-29 17:50 ` Eric Wong
  2023-12-29 17:50 ` [PATCH 4/4] gemspec: support rack 3.x Eric Wong
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-12-29 17:50 UTC (permalink / raw)
  To: raindrops-public

Compiler optimization isn't useful when doing portability checks
for any of the things we care about.
---
 ext/raindrops/extconf.rb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ext/raindrops/extconf.rb b/ext/raindrops/extconf.rb
index 1733703..b8f147c 100644
--- a/ext/raindrops/extconf.rb
+++ b/ext/raindrops/extconf.rb
@@ -1,6 +1,7 @@
 require 'mkmf'
 require 'shellwords'
 
+$CFLAGS += ' -O0 ' # faster checks
 dir_config('atomic_ops')
 have_func('mmap', 'sys/mman.h') or abort 'mmap() not found'
 have_func('munmap', 'sys/mman.h') or abort 'munmap() not found'
@@ -158,4 +159,5 @@
   apt-get install libatomic-ops-dev
 SRC
 create_header # generate extconf.h to avoid excessively long command-line
+$CFLAGS.sub!(/ -O0 /, '')
 create_makefile('raindrops_ext')

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] gemspec: support rack 3.x
  2023-12-29 17:50 [PATCH 0/4] lighter tests + rack 3 dependency fix Eric Wong
                   ` (2 preceding siblings ...)
  2023-12-29 17:50 ` [PATCH 3/4] extconf: disable optimization to speed up checks by ~3% Eric Wong
@ 2023-12-29 17:50 ` Eric Wong
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-12-29 17:50 UTC (permalink / raw)
  To: raindrops-public

Hopefully this doesn't cause more breakage and we'll never
actually need a rack 4
---
 raindrops.gemspec | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/raindrops.gemspec b/raindrops.gemspec
index 1de56a0..2f171db 100644
--- a/raindrops.gemspec
+++ b/raindrops.gemspec
@@ -21,6 +21,6 @@
   s.add_development_dependency('aggregate', '~> 0.2')
   s.add_development_dependency('test-unit', '~> 3.0')
   s.add_development_dependency('posix_mq', '~> 2.0')
-  s.add_development_dependency('rack', [ '>= 1.2', '< 3.0' ])
+  s.add_development_dependency('rack', [ '>= 1.2', '< 4' ])
   s.licenses = %w(LGPL-2.1+)
 end

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-29 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-29 17:50 [PATCH 0/4] lighter tests + rack 3 dependency fix Eric Wong
2023-12-29 17:50 ` [PATCH 1/4] tests: support running tests without rack||aggregate Eric Wong
2023-12-29 17:50 ` [PATCH 2/4] test/test_last_data_recv: don't require posix_mq Eric Wong
2023-12-29 17:50 ` [PATCH 3/4] extconf: disable optimization to speed up checks by ~3% Eric Wong
2023-12-29 17:50 ` [PATCH 4/4] gemspec: support rack 3.x Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/raindrops.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).