Skip to content

Commit

Permalink
More buggy tests, fix ruby-concurrency#590
Browse files Browse the repository at this point in the history
  • Loading branch information
pitr-ch committed Nov 5, 2016
1 parent f297472 commit 7f10d15
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 deletions.
41 changes: 19 additions & 22 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ require 'concurrent/version'
require 'concurrent/utility/native_extension_loader'

## load the gemspec files
CORE_GEMSPEC = Gem::Specification.load('concurrent-ruby.gemspec')
EXT_GEMSPEC = Gem::Specification.load('concurrent-ruby-ext.gemspec')
EDGE_GEMSPEC = Gem::Specification.load('concurrent-ruby-edge.gemspec')
CORE_GEMSPEC = Gem::Specification.load('concurrent-ruby.gemspec')
EXT_GEMSPEC = Gem::Specification.load('concurrent-ruby-ext.gemspec')
EDGE_GEMSPEC = Gem::Specification.load('concurrent-ruby-edge.gemspec')

## constants used for compile/build tasks

Expand All @@ -18,7 +18,7 @@ EDGE_NAME = 'edge'
JAVA_EXT_NAME = 'concurrent_ruby_ext'

if Concurrent.on_jruby?
CORE_GEM = "#{GEM_NAME}-#{Concurrent::VERSION}-java.gem"
CORE_GEM = "#{GEM_NAME}-#{Concurrent::VERSION}-java.gem"
else
CORE_GEM = "#{GEM_NAME}-#{Concurrent::VERSION}.gem"
EXT_GEM = "#{GEM_NAME}-ext-#{Concurrent::VERSION}.gem"
Expand Down Expand Up @@ -66,17 +66,17 @@ elsif Concurrent.allow_c_extensions?
require 'rake/extensiontask'

Rake::ExtensionTask.new(EXT_NAME, EXT_GEMSPEC) do |ext|
ext.ext_dir = 'ext/concurrent'
ext.lib_dir = 'lib/concurrent'
ext.ext_dir = 'ext/concurrent'
ext.lib_dir = 'lib/concurrent'
ext.source_pattern = '*.{c,h}'
ext.cross_compile = true
ext.cross_compile = true
ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
end

ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
platforms = {
'x86-mingw32' => 'i686-w64-mingw32',
'x64-mingw32' => 'x86_64-w64-mingw32'
'x86-mingw32' => 'i686-w64-mingw32',
'x64-mingw32' => 'x86_64-w64-mingw32'
}
platforms.each do |platform, prefix|
task "copy:#{EXT_NAME}:#{platform}:#{ruby_version}" do |t|
Expand Down Expand Up @@ -177,23 +177,20 @@ begin

RSpec::Core::RakeTask.new(:spec)

options = %w[ --color
--backtrace
--seed 1
--format documentation
--tag ~unfinished
--tag ~notravis
--tag ~buggy ]

RSpec::Core::RakeTask.new(:travis) do |t|
t.rspec_opts = '--color ' \
'--backtrace ' \
'--tag ~unfinished ' \
'--seed 1 ' \
'--format documentation ' \
'--tag ~notravis ' \
'--tag ~buggy'
t.rspec_opts = ['--color', *options].join(' ')
end

RSpec::Core::RakeTask.new(:appveyor) do |t|
t.rspec_opts = '--backtrace ' \
'--tag ~unfinished ' \
'--seed 1 ' \
'--format documentation ' \
'--tag ~notravis ' \
'--tag ~buggy'
t.rspec_opts = [*options].join(' ')
end

if Concurrent.on_windows?
Expand Down
8 changes: 4 additions & 4 deletions spec/concurrent/atomic/cyclic_barrier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module Concurrent

describe 'reset' do
it 'should release all waiting threads', buggy: true do
start_latch = CountDownLatch.new(1)
start_latch = CountDownLatch.new(1)
continue_latch = CountDownLatch.new(1)

Thread.new do
Expand Down Expand Up @@ -120,7 +120,7 @@ module Concurrent
expect(latch.wait(1)).to be_truthy
end

it 'return false if barrier has been reset' do
it 'return false if barrier has been reset', buggy: true do
latch = CountDownLatch.new(1)

t = Thread.new { latch.count_down if barrier.wait == false }
Expand Down Expand Up @@ -230,7 +230,7 @@ def barrier.simulate_spurious_wake_up

it 'should resist to spurious wake ups without timeout' do
@expected = false
t = Thread.new { barrier.wait; @expected = true }
t = Thread.new { barrier.wait; @expected = true }
t.join(0.1)

barrier.simulate_spurious_wake_up
Expand All @@ -241,7 +241,7 @@ def barrier.simulate_spurious_wake_up

it 'should resist to spurious wake ups with timeout' do
@expected = false
t = Thread.new { barrier.wait(0.5); @expected = true }
t = Thread.new { barrier.wait(0.5); @expected = true }

t.join(0.1)
barrier.simulate_spurious_wake_up
Expand Down
3 changes: 2 additions & 1 deletion spec/concurrent/atomic/reentrant_read_write_lock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def wait_up_to(secs, &condition)
end
end

it "wakes up waiting readers when the write lock is released" do
it "wakes up waiting readers when the write lock is released", buggy: true do
latch1,latch2 = CountDownLatch.new,CountDownLatch.new
good = AtomicFixnum.new(0)
threads = [
Expand All @@ -271,6 +271,7 @@ def wait_up_to(secs, &condition)
]
wait_up_to(0.2) { threads[3].status == 'sleep' }
# The last 3 threads should be waiting to acquire read locks now...
# TODO (pitr-ch 15-Oct-2016): https://travis-ci.org/ruby-concurrency/concurrent-ruby/jobs/166777543
(1..3).each { |n| expect(threads[n].status).to eql "sleep" }
(1..3).each { |n| expect(threads[n]).not_to hold(lock).for_read }
# Throw latch2 and the writer will wake up and release its write lock...
Expand Down
1 change: 1 addition & 0 deletions spec/concurrent/channel/buffer/base_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
end
t.join(0.1)

# TODO (pitr-ch 15-Oct-2016): fails on JRuby https://travis-ci.org/pitr-ch/concurrent-ruby/jobs/167937038
expect(subject.poll).to eq 42
end

Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/channel_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Concurrent

describe Channel, edge: true do
describe Channel, edge: true, buggy: true do

context 'initialization' do

Expand Down
3 changes: 2 additions & 1 deletion spec/concurrent/mvar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ def m.simulate_spurious_wake_up
expect(m.put(14)).to eq 14
end

it 'returns TIMEOUT on timeout on a full MVar' do
it 'returns TIMEOUT on timeout on a full MVar', buggy: true do
# TODO (pitr-ch 15-Oct-2016): fails on jruby
result = nil
Thread.new { result = m.put(14, 0.3) }
sleep(0.1)
Expand Down
1 change: 1 addition & 0 deletions spec/concurrent/synchronization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def ns_initialize
expect { Timeout.timeout(3) do
t = Thread.new { subject.wait }
sleep 0.1
# TODO (pitr-ch 15-Oct-2016): https://travis-ci.org/pitr-ch/concurrent-ruby/jobs/167933569
expect(t.status).to eq 'sleep'
subject.synchronize {} # we will deadlock here if #wait doesn't release lock
end }.not_to raise_error
Expand Down

0 comments on commit 7f10d15

Please sign in to comment.