deep_test 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ * 1.1.1 (February 9, 2008)
2
+
3
+ * No longer fork from Rake process.
4
+
1
5
  * 1.1.0
2
6
 
3
7
  * DeepTest::TestTask#processes= is now DeepTest::TestTask#number_of_workers=
data/Rakefile CHANGED
@@ -37,7 +37,7 @@ specification = Gem::Specification.new do |s|
37
37
  s.platform = Gem::Platform::RUBY
38
38
  s.name = "deep_test"
39
39
  s.summary = "DeepTest runs tests in multiple processes."
40
- s.version = "1.1.0"
40
+ s.version = "1.1.1"
41
41
  s.author = "anonymous z, Dan Manges, David Vollbracht"
42
42
  s.description = s.summary
43
43
  s.email = "daniel.manges@gmail.com"
@@ -49,7 +49,7 @@ specification = Gem::Specification.new do |s|
49
49
  s.rdoc_options << '--title' << "DeepTest" << '--main' << 'README' << '--line-numbers'
50
50
 
51
51
  s.autorequire = "deep_test"
52
- s.files = FileList['{lib,test}/**/*.{rb,rake}', 'README', 'CHANGELOG', 'Rakefile'].to_a
52
+ s.files = FileList['{lib,script,test}/**/*.{rb,rake}', 'README', 'CHANGELOG', 'Rakefile'].to_a
53
53
  end
54
54
 
55
55
  Rake::GemPackageTask.new(specification) do |package|
@@ -5,11 +5,8 @@ module DeepTest
5
5
  self
6
6
  end
7
7
 
8
- def self.run(args)
8
+ def self.run
9
9
  require "deep_test"
10
- ENV["RAILS_ENV"] = "test"
11
- Object.const_set "RAILS_ENV", "test"
12
- Dir.glob(ARGV.first).each { |file| load file }
13
10
  suite = Test::Unit::AutoRunner::COLLECTORS[:objectspace].call NO_FILTERS
14
11
  blackboard = DeepTest::RindaBlackboard.new
15
12
  supervisor = DeepTest::Supervisor.new blackboard
@@ -21,7 +18,3 @@ module DeepTest
21
18
  end
22
19
  end
23
20
  end
24
-
25
- if __FILE__ == $0
26
- exit DeepTest::Loader.run(ARGV)
27
- end
@@ -12,36 +12,9 @@ module DeepTest
12
12
  def define
13
13
  desc "Run '#{@name}' suite using DeepTest"
14
14
  task @name do
15
- begin
16
- deep_test_lib = File.expand_path(File.dirname(__FILE__) + "/..")
17
- $LOAD_PATH << deep_test_lib
18
- require "deep_test"
19
- warlock = DeepTest::Warlock.new
20
-
21
- # server
22
- warlock.start "server" do
23
- DeepTest::Server.start
24
- end
25
- sleep 0.25
26
-
27
- # workers
28
- number_of_workers.times do |i|
29
- warlock.start "worker #{i}" do
30
- srand # re-seed random numbers
31
- ENV["RAILS_ENV"] = "test"
32
- Object.const_set "RAILS_ENV", "test"
33
- Dir.glob(pattern).each { |file| load file }
34
- blackboard = DeepTest::RindaBlackboard.new
35
- DeepTest::Worker.new(blackboard).run
36
- end
37
- end
38
-
39
- # loader
40
- loader = File.expand_path(File.dirname(__FILE__) + "/loader.rb")
41
- ruby "-I#{deep_test_lib} #{loader} '#{pattern}'"
42
- ensure
43
- warlock.stop_all if warlock
44
- end
15
+ deep_test_lib = File.expand_path(File.dirname(__FILE__) + "/..")
16
+ runner = File.expand_path(File.dirname(__FILE__) + "/../../script/run_test_suite.rb")
17
+ ruby "-I#{deep_test_lib} #{runner} '#{number_of_workers}' '#{pattern}'"
45
18
  end
46
19
  end
47
20
 
data/lib/deep_test.rb CHANGED
@@ -13,6 +13,7 @@ require "deep_test/extensions/object_extension"
13
13
 
14
14
  require "deep_test/tuple_space_factory"
15
15
  require "deep_test/rinda_blackboard"
16
+ require "deep_test/loader"
16
17
  require "deep_test/server"
17
18
  require "deep_test/simple_test_blackboard"
18
19
  require "deep_test/supervised_test_suite"
@@ -0,0 +1,37 @@
1
+ number_of_workers, pattern = ARGV
2
+ begin
3
+ require "deep_test"
4
+ warlock = DeepTest::Warlock.new
5
+ Signal.trap("HUP") { warlock.stop_all; exit 0 }
6
+
7
+ Dir.glob(pattern).each { |file| load file }
8
+ Test::Unit.run = true
9
+
10
+ # server
11
+ warlock.start "server" do
12
+ DeepTest::Server.start
13
+ end
14
+ sleep 0.25
15
+
16
+ # workers
17
+ number_of_workers.to_i.times do |i|
18
+ warlock.start "worker #{i}" do
19
+ srand # re-seed random numbers
20
+ ActiveRecord::Base.connection.reconnect! if defined?(ActiveRecord::Base)
21
+ blackboard = DeepTest::RindaBlackboard.new
22
+ DeepTest::Worker.new(blackboard).run
23
+ end
24
+ end
25
+
26
+ passed = false
27
+ loader_pid = fork do
28
+ puts "Loader (#{$$})"
29
+ passed = DeepTest::Loader.run
30
+ exit(passed ? 0 : 1)
31
+ end
32
+ Process.wait(loader_pid)
33
+ passed = $?.success?
34
+ passed
35
+ ensure
36
+ warlock.stop_all if warlock
37
+ end
data/test/worker_test.rb CHANGED
@@ -51,4 +51,8 @@ unit_tests do
51
51
  assert_equal 0, result.failure_count
52
52
  assert_equal 0, result.assertion_count
53
53
  end
54
+
55
+ test "does not fork from rake" do
56
+ assert !defined?(Rake)
57
+ end
54
58
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: deep_test
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.0
7
- date: 2007-12-23 00:00:00 -05:00
6
+ version: 1.1.1
7
+ date: 2008-02-09 00:00:00 -05:00
8
8
  summary: DeepTest runs tests in multiple processes.
9
9
  require_paths:
10
10
  - lib
@@ -44,6 +44,7 @@ files:
44
44
  - lib/deep_test/extensions/error.rb
45
45
  - lib/deep_test/extensions/object_extension.rb
46
46
  - lib/deep_test/extensions/testresult.rb
47
+ - script/run_test_suite.rb
47
48
  - test/simple_test_blackboard_test.rb
48
49
  - test/supervised_test_suite_test.rb
49
50
  - test/supervisor_test.rb