Skip to content

Commit 529c078

Browse files
committed
Run each spec file in a process to detect missing requires
* Fixes #934.
1 parent 13db80c commit 529c078

File tree

137 files changed

+385
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+385
-162
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: CI
22
on: [push, pull_request]
3+
concurrency:
4+
group: ${{ github.ref }}
5+
cancel-in-progress: true
36

47
jobs:
58
build:
@@ -26,3 +29,17 @@ jobs:
2629
bundler-cache: true
2730
- name: Run tests
2831
run: bundle exec rake ci
32+
33+
isolated:
34+
name: "Test isolated"
35+
runs-on: ubuntu-latest
36+
env:
37+
RUBYOPT: '-w'
38+
steps:
39+
- uses: actions/checkout@v3
40+
- uses: ruby/setup-ruby@v1
41+
with:
42+
ruby-version: 3.2
43+
bundler-cache: true
44+
- run: bundle exec rake compile
45+
- run: bundle exec rake spec:isolated

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ source 'https://rubygems.org'
22

33
require File.join(File.dirname(__FILE__), 'lib/concurrent-ruby/concurrent/version')
44
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby-edge/concurrent/edge/version')
5-
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby/concurrent/utility/engine')
65

76
no_path = ENV['NO_PATH']
87
options = no_path ? {} : { path: '.' }

Rakefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ begin
9191
desc 'executed in CI'
9292
task :ci => [:compile, 'spec:ci']
9393

94+
desc 'run each spec file in a separate process to help find missing requires'
95+
task 'spec:isolated' do
96+
glob = "#{ENV['DIR'] || 'spec'}/**/*_spec.rb"
97+
from = ENV['FROM']
98+
env = { 'ISOLATED' => 'true' }
99+
Dir[glob].each do |spec|
100+
next if from and from != spec
101+
from = nil if from == spec
102+
103+
sh env, 'rspec', spec
104+
end
105+
end
106+
94107
task :default => [:clobber, :compile, :spec]
95108
rescue LoadError => e
96109
puts 'RSpec is not installed, skipping test task definitions: ' + e.message

concurrent-ruby.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby/concurrent/version')
2-
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby/concurrent/utility/engine')
32

43
Gem::Specification.new do |s|
54
git_files = `git ls-files`.split("\n")

docs-source/actor/format.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
input_paths.each_with_index do |input_path, i|
1414

1515
pid = fork do
16-
require File.join(root, 'init.rb')
16+
require_relative 'init'
1717

1818
begin
1919
output_path = input_path.gsub /\.in\.rb$/, '.out.rb'

docs-source/tvar.md

Lines changed: 2 additions & 2 deletions

examples/benchmark_map.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env ruby
22

3-
require "benchmark"
4-
require "concurrent"
3+
require 'benchmark'
4+
require 'concurrent'
55

66
hash = {}
77
map = Concurrent::Map.new

examples/format.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
input_paths.each_with_index do |input_path, i|
1313

1414
pid = fork do
15-
require_relative 'init.rb'
15+
require_relative 'init'
1616

1717
begin
1818
output_path = input_path.gsub /\.in\.rb$/, '.out.rb'

lib/concurrent-ruby-edge/concurrent/actor.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
# NOTE: finer grained than require 'concurrent/actor' not supported
2+
13
require 'concurrent/configuration'
24
require 'concurrent/executor/serialized_execution'
3-
require 'concurrent/synchronization'
45
require 'concurrent/edge/promises'
56

67
module Concurrent

lib/concurrent-ruby-edge/concurrent/channel/tick.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'concurrent/synchronization'
1+
require 'concurrent/synchronization/object'
22
require 'concurrent/utility/monotonic_time'
33

44
module Concurrent

0 commit comments

Comments
 (0)