From 60f2184922eedceb720307d25714bc9eb146b056 Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 4 Jul 2005 02:24:54 +0000 Subject: * test/{dbm,gdbm,sdbm}/test_{dbm,gdbm,sdbm}.rb: skip some tests which using fork on fork-less platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/dbm/test_dbm.rb | 11 +++++++++++ test/gdbm/test_gdbm.rb | 11 +++++++++++ test/sdbm/test_sdbm.rb | 10 ++++++++++ 3 files changed, 32 insertions(+) (limited to 'test') diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb index a5e2c4f4a1..9d63bdf5b3 100644 --- a/test/dbm/test_dbm.rb +++ b/test/dbm/test_dbm.rb @@ -61,6 +61,15 @@ if defined? DBM end end + def have_fork? + begin + fork{} + true + rescue NotImplementedError + false + end + end + def test_s_new_has_no_block # DBM.new ignore the block foo = true @@ -77,6 +86,7 @@ if defined? DBM assert_equal(DBM.open("tmptest_dbm") { :foo }, :foo) end def test_s_open_lock + return unless have_fork? # snip this test fork() { assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644)) sleep 2 @@ -115,6 +125,7 @@ if defined? DBM if not defined? DBM::NOLOCK return end + return unless have_fork? # snip this test fork() { assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644, diff --git a/test/gdbm/test_gdbm.rb b/test/gdbm/test_gdbm.rb index d2f3a945a0..307cd1c3da 100644 --- a/test/gdbm/test_gdbm.rb +++ b/test/gdbm/test_gdbm.rb @@ -58,6 +58,15 @@ if defined? GDBM end end + def have_fork? + begin + fork{} + true + rescue NotImplementedError + false + end + end + def test_s_new_has_no_block # GDBM.new ignore the block foo = true @@ -108,6 +117,7 @@ if defined? GDBM assert_equal(GDBM.open("tmptest_gdbm") { :foo }, :foo) end def test_s_open_lock + return unless have_fork? # snip this test fork() { assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644)) sleep 2 @@ -146,6 +156,7 @@ if defined? GDBM if not defined? GDBM::NOLOCK return end + return unless have_fork? # snip this test fork() { assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644, diff --git a/test/sdbm/test_sdbm.rb b/test/sdbm/test_sdbm.rb index d94b5e94af..58c21230ed 100644 --- a/test/sdbm/test_sdbm.rb +++ b/test/sdbm/test_sdbm.rb @@ -31,6 +31,15 @@ class TestSDBM < Test::Unit::TestCase end end + def have_fork? + begin + fork{} + true + rescue NotImplementedError + false + end + end + def test_version assert(! SDBM.const_defined?(:VERSION)) end @@ -70,6 +79,7 @@ class TestSDBM < Test::Unit::TestCase if not defined? SDBM::NOLOCK return end + return unless have_fork? # snip this test fork() { assert_instance_of(SDBM, sdbm = SDBM.open("tmptest_sdbm", 0644, -- cgit v1.2.3