File: test_thread_safety.rb

package info (click to toggle)
ruby-git 1.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,124 kB
  • sloc: ruby: 5,385; sh: 507; perl: 64; makefile: 6
file content (30 lines) | stat: -rw-r--r-- 471 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../test_helper'

class TestThreadSafety < Test::Unit::TestCase
  def setup
    set_file_paths
  end

  def test_git_init_bare
    dirs = []
    threads = []

    5.times do
      dirs << Dir.mktmpdir
    end

    dirs.each do |dir|
      threads << Thread.new do
        Git.init(dir, :bare => true)
      end
    end

    threads.each(&:join)

    dirs.each do |dir|
      Git.bare(dir).ls_files
    end
  end
end