about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-02-08 03:28:49 -0500
committerEric Wong <e@80x24.org>2014-02-08 08:35:41 +0000
commit922e7141e30fc0ef5fc973716fab20a272531300 (patch)
tree1b3d50c5074df40a2544c4c0e5c5b8fe0d2f5997 /test
parent2f7660ed8124bef150c48ce14f9df759e467e44c (diff)
downloadyahns-922e7141e30fc0ef5fc973716fab20a272531300.tar.gz
Diffstat (limited to 'test')
-rw-r--r--test/test_buffer_tmpdir.rb10
-rw-r--r--test/test_mt_accept.rb4
2 files changed, 11 insertions, 3 deletions
diff --git a/test/test_buffer_tmpdir.rb b/test/test_buffer_tmpdir.rb
index c7665f6..8461346 100644
--- a/test/test_buffer_tmpdir.rb
+++ b/test/test_buffer_tmpdir.rb
@@ -9,12 +9,18 @@ class TestBufferTmpdir < Testcase
   attr_reader :ino, :tmpdir
 
   def setup
-    @ino = SleepyPenguin::Inotify.new(:CLOEXEC)
+    @ino = nil
+    begin
+      @ino = SleepyPenguin::Inotify.new(:CLOEXEC)
+    rescue
+      skip "test needs inotify"
+    end
     @tmpdir = Dir.mktmpdir
     server_helper_setup
   end
 
   def teardown
+    return unless @ino
     server_helper_teardown
     @ino.close
     FileUtils.rm_rf @tmpdir
@@ -100,4 +106,4 @@ class TestBufferTmpdir < Testcase
     c.close if c
     quit_wait(pid)
   end
-end if SleepyPenguin.const_defined?(:Inotify)
+end
diff --git a/test/test_mt_accept.rb b/test/test_mt_accept.rb
index e006af8..37813d4 100644
--- a/test/test_mt_accept.rb
+++ b/test/test_mt_accept.rb
@@ -10,6 +10,8 @@ class TestMtAccept < Testcase
   alias teardown server_helper_teardown
 
   def test_mt_accept
+    skip "Linux kernel required" unless RUBY_PLATFORM =~ /linux/
+    skip "/proc not mounted" unless File.directory?("/proc")
     err, cfg, host, port = @err, Yahns::Config.new, @srv.addr[3], @srv.addr[1]
     opts = { threads: 1 }
     cfg.instance_eval do
@@ -45,4 +47,4 @@ class TestMtAccept < Testcase
   ensure
     quit_wait(pid)
   end
-end if RUBY_PLATFORM =~ /linux/ && File.directory?("/proc")
+end