Sha256: 171c4f16b3baa5473cce96559aee8f915a0aada92a5b9a9d51f412da2571cc86

Contents?: true

Size: 842 Bytes

Versions: 4

Compression:

Stored size: 842 Bytes

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), '../../..', 'test_helper.rb')

require 'rbbt-util'
require 'rbbt/util/misc/lock'

class TestLock < Test::Unit::TestCase
  def __test_stress
    size = 1000000
    num = 50
    cpus = 200
    TmpFile.with_file do |dir|
      TSV.traverse (0..size).to_a, :cpus => cpus, :type => :array, :bar => true do |i|
        begin
          v = rand(num)
          file = File.join(dir, "file-" << v.to_s)
          Persist.persist("foo", :string, :file => file, :update => true) do
            Process.pid.to_s
          end

          txt = `ls -la /proc/#{Process.pid}/fd |grep deleted`
          Open.write(file, txt)
          puts [Process.pid, txt.split("\n").length] * ": "
        rescue Exception
          Log.exception $!
          raise $!
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rbbt-util-5.13.30 test/rbbt/util/misc/test_lock.rb
rbbt-util-5.13.29 test/rbbt/util/misc/test_lock.rb
rbbt-util-5.13.28 test/rbbt/util/misc/test_lock.rb
rbbt-util-5.13.27 test/rbbt/util/misc/test_lock.rb