fsdb 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,54 +0,0 @@
1
-
2
- if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
3
- require 'spec/rake/verify_rcov'
4
-
5
- namespace :spec do
6
-
7
- desc 'Run all specs with basic output'
8
- Spec::Rake::SpecTask.new(:run) do |t|
9
- t.ruby_opts = PROJ.ruby_opts
10
- t.spec_opts = PROJ.spec.opts
11
- t.spec_files = PROJ.spec.files
12
- t.libs += PROJ.libs
13
- end
14
-
15
- desc 'Run all specs with text output'
16
- Spec::Rake::SpecTask.new(:specdoc) do |t|
17
- t.ruby_opts = PROJ.ruby_opts
18
- t.spec_opts = PROJ.spec.opts + ['--format', 'specdoc']
19
- t.spec_files = PROJ.spec.files
20
- t.libs += PROJ.libs
21
- end
22
-
23
- if HAVE_RCOV
24
- desc 'Run all specs with RCov'
25
- Spec::Rake::SpecTask.new(:rcov) do |t|
26
- t.ruby_opts = PROJ.ruby_opts
27
- t.spec_opts = PROJ.spec.opts
28
- t.spec_files = PROJ.spec.files
29
- t.libs += PROJ.libs
30
- t.rcov = true
31
- t.rcov_dir = PROJ.rcov.dir
32
- t.rcov_opts = PROJ.rcov.opts + ['--exclude', 'spec']
33
- end
34
-
35
- RCov::VerifyTask.new(:verify) do |t|
36
- t.threshold = PROJ.rcov.threshold
37
- t.index_html = File.join(PROJ.rcov.dir, 'index.html')
38
- t.require_exact_threshold = PROJ.rcov.threshold_exact
39
- end
40
-
41
- task :verify => :rcov
42
- remove_desc_for_task %w(spec:clobber_rcov)
43
- end
44
-
45
- end # namespace :spec
46
-
47
- desc 'Alias to spec:run'
48
- task :spec => 'spec:run'
49
-
50
- task :clobber => 'spec:clobber_rcov' if HAVE_RCOV
51
-
52
- end # if HAVE_SPEC_RAKE_SPECTASK
53
-
54
- # EOF
@@ -1,47 +0,0 @@
1
-
2
- if HAVE_SVN
3
-
4
- unless PROJ.svn.root
5
- info = %x/svn info ./
6
- m = %r/^Repository Root:\s+(.*)$/.match(info)
7
- PROJ.svn.root = (m.nil? ? '' : m[1])
8
- end
9
- PROJ.svn.root = File.join(PROJ.svn.root, PROJ.svn.path) unless PROJ.svn.path.empty?
10
-
11
- namespace :svn do
12
-
13
- # A prerequisites task that all other tasks depend upon
14
- task :prereqs
15
-
16
- desc 'Show tags from the SVN repository'
17
- task :show_tags => 'svn:prereqs' do |t|
18
- tags = %x/svn list #{File.join(PROJ.svn.root, PROJ.svn.tags)}/
19
- tags.gsub!(%r/\/$/, '')
20
- tags = tags.split("\n").sort {|a,b| b <=> a}
21
- puts tags
22
- end
23
-
24
- desc 'Create a new tag in the SVN repository'
25
- task :create_tag => 'svn:prereqs' do |t|
26
- v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
27
- abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
28
-
29
- svn = PROJ.svn
30
- trunk = File.join(svn.root, svn.trunk)
31
- tag = "%s-%s" % [PROJ.name, PROJ.version]
32
- tag = File.join(svn.root, svn.tags, tag)
33
- msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
34
-
35
- puts "Creating SVN tag '#{tag}'"
36
- unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
37
- abort "Tag creation failed"
38
- end
39
- end
40
-
41
- end # namespace :svn
42
-
43
- task 'gem:release' => 'svn:create_tag'
44
-
45
- end # if PROJ.svn.path
46
-
47
- # EOF
@@ -1,40 +0,0 @@
1
-
2
- if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
3
- require 'rake/testtask'
4
-
5
- namespace :test do
6
-
7
- Rake::TestTask.new(:run) do |t|
8
- t.libs = PROJ.libs
9
- t.test_files = if test(?f, PROJ.test.file) then [PROJ.test.file]
10
- else PROJ.test.files end
11
- t.ruby_opts += PROJ.ruby_opts
12
- t.ruby_opts += PROJ.test.opts
13
- end
14
-
15
- if HAVE_RCOV
16
- desc 'Run rcov on the unit tests'
17
- task :rcov => :clobber_rcov do
18
- opts = PROJ.rcov.opts.dup << '-o' << PROJ.rcov.dir
19
- opts = opts.join(' ')
20
- files = if test(?f, PROJ.test.file) then [PROJ.test.file]
21
- else PROJ.test.files end
22
- files = files.join(' ')
23
- sh "#{RCOV} #{files} #{opts}"
24
- end
25
-
26
- task :clobber_rcov do
27
- rm_r 'coverage' rescue nil
28
- end
29
- end
30
-
31
- end # namespace :test
32
-
33
- desc 'Alias to test:run'
34
- task :test => 'test:run'
35
-
36
- task :clobber => 'test:clobber_rcov' if HAVE_RCOV
37
-
38
- end
39
-
40
- # EOF
@@ -1,36 +0,0 @@
1
- if HAVE_ZENTEST
2
-
3
- # --------------------------------------------------------------------------
4
- if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
5
- require 'autotest'
6
-
7
- namespace :test do
8
- task :autotest do
9
- Autotest.run
10
- end
11
- end
12
-
13
- desc "Run the autotest loop"
14
- task :autotest => 'test:autotest'
15
-
16
- end # if test
17
-
18
- # --------------------------------------------------------------------------
19
- if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
20
- require 'autotest/rspec'
21
-
22
- namespace :spec do
23
- task :autotest do
24
- load '.autotest' if test(?f, '.autotest')
25
- Autotest::Rspec.run
26
- end
27
- end
28
-
29
- desc "Run the autotest loop"
30
- task :autotest => 'spec:autotest'
31
-
32
- end # if rspec
33
-
34
- end # if HAVE_ZENTEST
35
-
36
- # EOF
@@ -1,31 +0,0 @@
1
- [corolla ~/ruby/prj/fsdb-0.4/test] nice -n 9 ruby test-concurrency.rb 10 1 10000
2
- [=============================> ] 49.55800% done/usr/local/lib/ruby/1.8/yaml.rb:193:in `end_object': method `write' called on terminated object (0x804e25c) (NotImplementedError)
3
- from /usr/local/lib/ruby/1.8/yaml.rb:193:in `quick_emit'
4
- from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:55:in `to_yaml'
5
- from /usr/local/lib/ruby/site_ruby/1.8/fsdb/formats.rb:138
6
- from /usr/local/lib/ruby/site_ruby/1.8/fsdb/formats.rb:138:in `[]'
7
- from /usr/local/lib/ruby/site_ruby/1.8/fsdb/formats.rb:60:in `dump'
8
- from /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:744:in `dump'
9
- from /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:621:in `[]='
10
- from /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:620:in `open_write_lock'
11
- ... 38 levels...
12
- from test-concurrency.rb:58:in `start_processes'
13
- from test-concurrency.rb:37:in `manage_children'
14
- from test-concurrency.rb:31:in `run'
15
- from test-concurrency.rb:354
16
- test-concurrency.rb:265:in `status_meter': undefined method `[]' for false:FalseClass (NoMethodError)
17
- from test-concurrency.rb:265:in `sum'
18
- from test-concurrency.rb:14:in `inject'
19
- from test-concurrency.rb:14:in `each'
20
- from test-concurrency.rb:14:in `inject'
21
- from test-concurrency.rb:14:in `sum'
22
- from test-concurrency.rb:265:in `status_meter'
23
- from test-concurrency.rb:287:in `monitor'
24
- from test-concurrency.rb:286:in `loop'
25
- from test-concurrency.rb:289:in `monitor'
26
- from test-concurrency.rb:285:in `initialize'
27
- from test-concurrency.rb:285:in `new'
28
- from test-concurrency.rb:285:in `monitor'
29
- from test-concurrency.rb:38:in `manage_children'
30
- from test-concurrency.rb:31:in `run'
31
- from test-concurrency.rb:354
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'fsdb/mutex'
4
-
5
- include FSDB
6
-
7
- mutex = Mutex.new
8
- counter = 0
9
- thread_count = (ARGV.shift || 10).to_i
10
- rep_count = (ARGV.shift || 1000).to_i
11
-
12
- threads = (0...thread_count).map do |n|
13
- Thread.new do
14
- thread = Thread.current
15
- thread[:id] = n
16
- rep_count.times do
17
- mutex.synchronize do
18
- counter += 1
19
- end
20
- end
21
- end
22
- end
23
-
24
- threads.each {|t| t.join}
25
-
26
- expected = thread_count * rep_count
27
- actual = counter
28
-
29
- if expected == actual
30
- puts "Test passed: #{actual} operations"
31
- else
32
- puts "Test failed: #{actual} < #{expected} expected"
33
- end