~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to test/test_pstore.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum, Daigo Moriwaki, Lucas Nussbaum
  • Date: 2011-07-25 20:27:20 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20110725202720-9qfs7iam0ml7e1kc
Tags: 1.9.2.290-1
[ Daigo Moriwaki ]
* New upstream release.
* Removed debian/patches/110411_disable_osslv2.patch, which has been applied
  by the upstream.
* Added a patch: debian/patches/debian/patches/110716-bigdecimal,
  which was backported from the upstream (r30993)
  (CVE-2011-0188; Closes: 628450)

[ Lucas Nussbaum ]
* Build-depend on tcl-dev and tk-dev instead of {tcl,tk}8.4-dev.
* Update Lucas' email address.
* Add 110825-ossl-config.diff: backport changes to the OpenSSL
  extension to fix test failure.
* Add patch 110720_tcltk_disable_rpath.diff: disable rpath in tcltk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
      end
72
72
    end
73
73
  end
 
74
 
 
75
  def test_thread_safe
 
76
    assert_raise(PStore::Error) do
 
77
      flag = false
 
78
      Thread.new do
 
79
        @pstore.transaction do
 
80
          @pstore[:foo] = "bar"
 
81
          flag = true
 
82
          sleep 1
 
83
        end
 
84
      end
 
85
      until flag; end
 
86
      @pstore.transaction {}
 
87
    end
 
88
    assert_block do
 
89
      pstore = PStore.new("pstore.tmp2.#{Process.pid}",true)
 
90
      flag = false
 
91
      Thread.new do
 
92
        pstore.transaction do
 
93
          pstore[:foo] = "bar"
 
94
          flag = true
 
95
          sleep 1
 
96
        end
 
97
      end
 
98
      until flag; end
 
99
      pstore.transaction { pstore[:foo] == "bar" }
 
100
      File.unlink("pstore.tmp2.#{Process.pid}") rescue nil
 
101
    end
 
102
  end
 
103
  
 
104
  def test_nested_transaction_raises_error
 
105
    assert_raise(PStore::Error) do
 
106
      @pstore.transaction { @pstore.transaction { } }
 
107
    end
 
108
    pstore = PStore.new("pstore.tmp2.#{Process.pid}", true)
 
109
    assert_raise(PStore::Error) do
 
110
      pstore.transaction { pstore.transaction { } }
 
111
    end
 
112
  end
74
113
end