parallel_tests 0.12.4 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock
CHANGED
@@ -63,30 +63,10 @@ module ParallelTests
|
|
63
63
|
end.join(";")
|
64
64
|
cmd = "#{exports};#{cmd}"
|
65
65
|
|
66
|
-
output,
|
67
|
-
|
68
|
-
# - JRuby's popen3 doesn't pass arguments correctly to the shell, so we use stdin
|
69
|
-
# - JRuby's open cannot handle local variables properly so we would have to use instance variables
|
70
|
-
Open3.popen3("sh -") do |stdin, stdout, stderr, thread|
|
71
|
-
stdin.puts cmd
|
72
|
-
stdin.close
|
73
|
-
output, errput = capture_output(stdout, stderr, silence)
|
74
|
-
end
|
75
|
-
exitstatus = $?.exitstatus
|
76
|
-
elsif RUBY_VERSION =~ /^1\.8/ or ENV["TEAMCITY_RAKE_RUNNER_MODE"] # fix #207
|
77
|
-
open("|#{cmd}", "r") do |output|
|
78
|
-
output, errput = capture_output(output, nil, silence)
|
79
|
-
end
|
80
|
-
exitstatus = $?.exitstatus
|
81
|
-
else
|
82
|
-
Open3.popen3(cmd) do |stdin, stdout, stderr, thread|
|
83
|
-
stdin.close
|
84
|
-
output, errput = capture_output(stdout, stderr, silence)
|
85
|
-
exitstatus = thread.value.exitstatus
|
86
|
-
end
|
87
|
-
end
|
66
|
+
output = open("|#{cmd}", "r") { |output| capture_output(output, silence) }
|
67
|
+
exitstatus = $?.exitstatus
|
88
68
|
|
89
|
-
{:stdout => output, :
|
69
|
+
{:stdout => output, :exit_status => exitstatus}
|
90
70
|
end
|
91
71
|
|
92
72
|
def self.find_results(test_output)
|
@@ -126,24 +106,16 @@ module ParallelTests
|
|
126
106
|
end
|
127
107
|
|
128
108
|
# read output of the process and print it in chunks
|
129
|
-
def self.capture_output(out,
|
130
|
-
|
109
|
+
def self.capture_output(out, silence)
|
110
|
+
result = ""
|
131
111
|
loop do
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
results[index] << read
|
137
|
-
if index == 1 || !silence
|
138
|
-
output.print read
|
139
|
-
output.flush
|
140
|
-
end
|
141
|
-
rescue EOFError
|
142
|
-
raise if index == 0 # we only care about the end of stdout
|
143
|
-
end
|
112
|
+
begin
|
113
|
+
read = out.readpartial(1000000) # read whatever chunk we can get
|
114
|
+
result << read
|
115
|
+
$stdout.print read if !silence
|
144
116
|
end
|
145
117
|
end rescue EOFError
|
146
|
-
|
118
|
+
result
|
147
119
|
end
|
148
120
|
|
149
121
|
def self.with_runtime_info(tests)
|
@@ -73,4 +73,45 @@ describe ParallelTests::RSpec::RuntimeLogger do
|
|
73
73
|
result.should_not include('FooBar')
|
74
74
|
result.should include('foo.rb')
|
75
75
|
end
|
76
|
+
|
77
|
+
context "integration" do
|
78
|
+
around do |example|
|
79
|
+
Dir.mktmpdir do |dir|
|
80
|
+
Dir.chdir(dir, &example)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def write(file, content)
|
85
|
+
FileUtils.mkdir_p(File.dirname(file))
|
86
|
+
File.open(file, 'w') { |f| f.write content }
|
87
|
+
end
|
88
|
+
|
89
|
+
it "logs shared examples into the running files" do
|
90
|
+
pending "no support in rspec for this :/"
|
91
|
+
|
92
|
+
write "spec/spec_helper.rb", <<-RUBY
|
93
|
+
shared_examples "foo" do
|
94
|
+
it "is slow" do
|
95
|
+
sleep 0.5
|
96
|
+
end
|
97
|
+
end
|
98
|
+
RUBY
|
99
|
+
|
100
|
+
["a", "b"].each do |letter|
|
101
|
+
write "spec/#{letter}_spec.rb", <<-RUBY
|
102
|
+
require 'spec_helper'
|
103
|
+
describe 'xxx' do
|
104
|
+
it_behaves_like "foo"
|
105
|
+
end
|
106
|
+
RUBY
|
107
|
+
end
|
108
|
+
|
109
|
+
system("TEST_ENV_NUMBER=1 rspec spec -I #{Bundler.root.join("lib")} --format ParallelTests::RSpec::RuntimeLogger --out runtime.log 2>&1") || raise("nope")
|
110
|
+
|
111
|
+
result = File.read("runtime.log")
|
112
|
+
result.should include "a_spec:0.5"
|
113
|
+
result.should include "b_spec:0.5"
|
114
|
+
result.should_not include "spec_helper"
|
115
|
+
end
|
116
|
+
end
|
76
117
|
end
|
@@ -300,7 +300,6 @@ EOF
|
|
300
300
|
result = call("ruby #{path}", 1, 4, {})
|
301
301
|
result.should == {
|
302
302
|
:stdout => "2\n",
|
303
|
-
:stderr => "",
|
304
303
|
:exit_status => 0
|
305
304
|
}
|
306
305
|
end
|
@@ -311,7 +310,6 @@ EOF
|
|
311
310
|
result = call("ruby #{path}", 0, 4, {})
|
312
311
|
result.should == {
|
313
312
|
:stdout => "\"\"\n",
|
314
|
-
:stderr => "",
|
315
313
|
:exit_status => 0
|
316
314
|
}
|
317
315
|
end
|
@@ -322,24 +320,19 @@ EOF
|
|
322
320
|
result = call("ruby #{path}", 1, 4, {})
|
323
321
|
result.should == {
|
324
322
|
:stdout => "4\n",
|
325
|
-
:stderr => "",
|
326
323
|
:exit_status => 0
|
327
324
|
}
|
328
325
|
end
|
329
326
|
end
|
330
327
|
|
331
328
|
it "skips reads from stdin" do
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
:stderr => "",
|
340
|
-
:exit_status => 0
|
341
|
-
}
|
342
|
-
end
|
329
|
+
pending "hangs on normal ruby, works on jruby" unless RUBY_PLATFORM == "java"
|
330
|
+
run_with_file("$stdin.read; puts 123") do |path|
|
331
|
+
result = call("ruby #{path}", 1, 2, {})
|
332
|
+
result.should == {
|
333
|
+
:stdout => "123\n",
|
334
|
+
:exit_status => 0
|
335
|
+
}
|
343
336
|
end
|
344
337
|
end
|
345
338
|
|
@@ -348,14 +341,13 @@ EOF
|
|
348
341
|
result = call("ruby #{path}", 1, 4, {})
|
349
342
|
result.should == {
|
350
343
|
:stdout => "123\n345\n",
|
351
|
-
:stderr => "",
|
352
344
|
:exit_status => 0
|
353
345
|
}
|
354
346
|
end
|
355
347
|
end
|
356
348
|
|
357
349
|
it "prints output while running" do
|
358
|
-
pending if RUBY_PLATFORM == "java"
|
350
|
+
pending "too slow" if RUBY_PLATFORM == " java"
|
359
351
|
run_with_file("$stdout.sync = true; puts 123; sleep 0.1; print 345; sleep 0.1; puts 567") do |path|
|
360
352
|
received = ""
|
361
353
|
$stdout.stub(:print).with{|x| received << x.strip }
|
@@ -363,7 +355,6 @@ EOF
|
|
363
355
|
received.should == "123345567"
|
364
356
|
result.should == {
|
365
357
|
:stdout => "123\n345567\n",
|
366
|
-
:stderr => "",
|
367
358
|
:exit_status => 0
|
368
359
|
}
|
369
360
|
end
|
@@ -374,7 +365,6 @@ EOF
|
|
374
365
|
result = call("ruby #{path}", 1, 4, {})
|
375
366
|
result.should == {
|
376
367
|
:stdout => "123\n345\n",
|
377
|
-
:stderr => "",
|
378
368
|
:exit_status => 0
|
379
369
|
}
|
380
370
|
end
|
@@ -386,7 +376,6 @@ EOF
|
|
386
376
|
result = call("ruby #{path}", 1, 4, :serialize_stdout => true)
|
387
377
|
result.should == {
|
388
378
|
:stdout => "123\n",
|
389
|
-
:stderr => "",
|
390
379
|
:exit_status => 0
|
391
380
|
}
|
392
381
|
end
|
@@ -397,26 +386,21 @@ EOF
|
|
397
386
|
result = call("ruby #{path}", 1, 4, {})
|
398
387
|
result.should == {
|
399
388
|
:stdout => "123\n",
|
400
|
-
:stderr => "",
|
401
389
|
:exit_status => 5
|
402
390
|
}
|
403
391
|
end
|
404
392
|
end
|
405
393
|
|
406
394
|
it "prints each stream to the correct stream" do
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
:stderr => "345\n",
|
415
|
-
:exit_status => 5
|
416
|
-
}
|
417
|
-
end
|
418
|
-
err.should == "345\n"
|
395
|
+
pending "open3"
|
396
|
+
out, err = run_with_file("puts 123 ; $stderr.puts 345 ; exit 5") do |path|
|
397
|
+
result = call("ruby #{path}", 1, 4, {})
|
398
|
+
result.should == {
|
399
|
+
:stdout => "123\n",
|
400
|
+
:exit_status => 5
|
401
|
+
}
|
419
402
|
end
|
403
|
+
err.should == "345\n"
|
420
404
|
end
|
421
405
|
|
422
406
|
it "uses a lower priority process when the nice option is used" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parallel
|
@@ -96,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
segments:
|
98
98
|
- 0
|
99
|
-
hash:
|
99
|
+
hash: 1322916282781841977
|
100
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
101
|
none: false
|
102
102
|
requirements:
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
segments:
|
107
107
|
- 0
|
108
|
-
hash:
|
108
|
+
hash: 1322916282781841977
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
111
|
rubygems_version: 1.8.25
|