diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-12 09:31:40 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-12 09:31:40 +0000 |
| commit | d6a777ff67150919445da679cfd19a2df6beb74f (patch) | |
| tree | 89b431b781950d47907b84ec57ec90459edc8ff8 /test | |
| parent | fa71851de06bba5fe0870131e1be4e1f98a51d79 (diff) | |
| download | ruby-d6a777ff67150919445da679cfd19a2df6beb74f.tar.gz ruby-d6a777ff67150919445da679cfd19a2df6beb74f.tar.xz ruby-d6a777ff67150919445da679cfd19a2df6beb74f.zip | |
* test/dbm/test_dbm.rb: remove locking test, which may not be
supported on some platforms. [ruby-dev:27030]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
| -rw-r--r-- | test/dbm/test_dbm.rb | 77 | ||||
| -rw-r--r-- | test/ruby/test_env.rb | 10 |
2 files changed, 4 insertions, 83 deletions
diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb index 4f49da3f6..d566015df 100644 --- a/test/dbm/test_dbm.rb +++ b/test/dbm/test_dbm.rb @@ -85,83 +85,6 @@ if defined? DBM def test_s_open_with_block 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 - } - begin - sleep 1 - assert_raise(Errno::EWOULDBLOCK, "NEVER MIND IF YOU USE Berkeley DB3") { - begin - assert_instance_of(DBM, dbm2 = DBM.open("tmptest_dbm", 0644)) - rescue Errno::EAGAIN, Errno::EACCES, Errno::EINVAL - raise Errno::EWOULDBLOCK - end - } - ensure - Process.wait - end - end - -=begin - # Is it guaranteed on many OS? - def test_s_open_lock_one_process - # locking on one process - assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644)) - assert_raise(Errno::EWOULDBLOCK) { - begin - DBM.open("tmptest_dbm", 0644) - rescue Errno::EAGAIN - raise Errno::EWOULDBLOCK - end - } - end -=end - - def test_s_open_nolock - # dbm 1.8.0 specific - 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, - DBM::NOLOCK)) - sleep 2 - } - sleep 1 - begin - dbm2 = nil - assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) { - assert_instance_of(DBM, dbm2 = DBM.open("tmptest_dbm", 0644)) - } - ensure - Process.wait - dbm2.close if dbm2 - end - - p Dir.glob("tmptest_dbm*") if $DEBUG - - fork() { - assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644)) - sleep 2 - } - begin - sleep 1 - dbm2 = nil - assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) { - # this test is failed on Cygwin98 (???) - assert_instance_of(DBM, dbm2 = DBM.open("tmptest_dbm", 0644, - DBM::NOLOCK)) - } - ensure - Process.wait - dbm2.close if dbm2 - end - end def test_s_open_error assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0)) diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb index edc7dcaf6..3a65f91fa 100644 --- a/test/ruby/test_env.rb +++ b/test/ruby/test_env.rb @@ -4,15 +4,13 @@ class TestEnv < Test::Unit::TestCase IGNORE_CASE = /djgpp|bccwin|mswin|mingw/ =~ RUBY_PLATFORM def setup - @backup = ENV['test'] - @BACKUP = ENV['TEST'] - ENV['test'] = nil - ENV['TEST'] = nil + @backup = ENV.delete('test') + @BACKUP = ENV.delete('TEST') end def teardown - ENV['test'] = @backup - ENV['TEST'] = @BACKUP + ENV['test'] = @backup if @backup + ENV['TEST'] = @BACKUP if @BACKUP end def test_bracket |
