testr 14.2.0 → 14.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,38 @@
1
+ ------------------------------------------------------------------------------
2
+ Version 14.3.0 (2012-01-20)
3
+ ------------------------------------------------------------------------------
4
+
5
+ External changes:
6
+
7
+ * testr(1): notify user while dispatching their commands. This is especially
8
+ useful when the "rerun_passed_test_files" command has been dispatched but
9
+ there are no passed test files, so nothing happens and from the user's
10
+ perspective: TestR sucks because it's unresponsive.
11
+
12
+ * config/testr/rails: Reopen connections in forked workers to fix errors:
13
+
14
+ Mysql2::Error: MySQL server has gone away
15
+ PGError: connection not open
16
+
17
+ Thanks to Spencer Steffen for [contributing this solution](
18
+ https://github.com/sunaku/testr/issues/14#issuecomment-3539470).
19
+
20
+ * testr-driver(1): document the "over" status message in manual page.
21
+
22
+ Internal changes:
23
+
24
+ * testr-driver(1): keep same herald; only replace master.
25
+
26
+ * testr(1): shorten code for loop break on quit command.
27
+
28
+ * server: rename `@upstream` to `@client` for coherence.
29
+
30
+ * Can pass lambda and proc with block to `<<` method.
31
+
32
+ * Explain `$0` override at the start of bin/ scripts.
33
+
34
+ * LICENSE: credit our most recent contributors.
35
+
1
36
  ------------------------------------------------------------------------------
2
37
  Version 14.2.0 (2012-01-16)
3
38
  ------------------------------------------------------------------------------
data/LICENSE CHANGED
@@ -5,6 +5,8 @@ Copyright 2011 Brian D. Burns <burns180@gmail.com>
5
5
  Copyright 2011 Daniel Pittman <daniel@rimspace.net>
6
6
  Copyright 2011 Jacob Helwig <jacob@technosorcery.net>
7
7
  Copyright 2011 Corné Verbruggen <corne@g-majeur.nl>
8
+ Copyright 2012 Jose Pablo Barrantes <xjpablobrx@gmail.com>
9
+ Copyright 2012 Spencer Steffen <spencer@citrusme.com>
8
10
 
9
11
  Permission to use, copy, modify, and/or distribute this software for any
10
12
  purpose with or without fee is hereby granted, provided that the above
@@ -193,16 +193,14 @@ worker process is forked to run a test file. These functions are given:
193
193
 
194
194
  For example, to see some real values:
195
195
 
196
- TestR::Config.before_fork_hooks << lambda {
197
- |worker_number, log_file, test_file, test_names|
198
-
196
+ TestR::Config.before_fork_hooks << lambda do |worker_number, log_file, test_file, test_names|
199
197
  p :before_fork_hooks => {
200
198
  :worker_number => worker_number,
201
199
  :log_file => log_file,
202
200
  :test_file => test_file,
203
201
  :test_names => test_names,
204
202
  }
205
- }
203
+ end
206
204
 
207
205
  ### TestR::Config.after_fork_hooks
208
206
 
@@ -220,9 +218,7 @@ by `testr-master`. These functions are given:
220
218
 
221
219
  For example, to see some real values, including the worker process' PID:
222
220
 
223
- TestR::Config.after_fork_hooks << lambda {
224
- |worker_number, log_file, test_file, test_names|
225
-
221
+ TestR::Config.after_fork_hooks << lambda do |worker_number, log_file, test_file, test_names|
226
222
  p :after_fork_hooks => {
227
223
  :worker_pid => $$,
228
224
  :worker_number => worker_number,
@@ -230,7 +226,7 @@ For example, to see some real values, including the worker process' PID:
230
226
  :test_file => test_file,
231
227
  :test_names => test_names,
232
228
  }
233
- }
229
+ end
234
230
 
235
231
  The first function in this array instructs Test::Unit and RSpec to only run
236
232
  those tests that correspond to the given `test_names` values. This
data/bin/testr CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
3
 
4
- TESTR 1 "2012-01-16" "14.2.0"
4
+ TESTR 1 "2012-01-20" "14.3.0"
5
5
  =============================
6
6
 
7
7
  NAME
@@ -36,7 +36,7 @@ testr(1), testr-driver(1), testr-master(1), testr-herald(1)
36
36
 
37
37
  =end =========================================================================
38
38
 
39
- $0 = File.basename(__FILE__)
39
+ $0 = File.basename(__FILE__) # for easier indentification in ps(1) output
40
40
 
41
41
  require 'binman'
42
42
  BinMan.help
@@ -89,15 +89,12 @@ COMMANDS = {
89
89
  begin
90
90
  while key = STDIN.gets.chomp
91
91
  if command = COMMANDS[key]
92
- if command == :quit
93
- @driver.quit
94
- break
95
- else
96
- @driver.send [command]
97
- end
98
- else
99
- COMMANDS.each do |key, cmd|
100
- warn "testr: Type #{key} then ENTER to #{cmd.to_s.tr('_', ' ')}."
92
+ warn "testr: Sending #{command.to_s.inspect} command..."
93
+ @driver.send [command]
94
+ break if command == :quit
95
+ else # invalid command
96
+ COMMANDS.each do |key, command|
97
+ warn "testr: Type #{key} then ENTER to #{command.to_s.tr('_', ' ')}."
101
98
  end
102
99
  end
103
100
  end
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
3
 
4
- TESTR-DRIVER 1 "2012-01-16" "14.2.0"
4
+ TESTR-DRIVER 1 "2012-01-20" "14.3.0"
5
5
  ====================================
6
6
 
7
7
  NAME
@@ -21,10 +21,6 @@ This program reads the following single-line commands (JSON arrays) from its
21
21
  standard input stream and performs the respective actions as described below.
22
22
  It also funnels the standard output stream of testr-master(1) into its own.
23
23
 
24
- When testr-herald(1) reports that a file belonging to the test execution
25
- overhead has been modified, this program replaces testr-master(1) with a new
26
- instance, which then absorbs the modified test execution overhead into itself.
27
-
28
24
  `["run_all_test_files"]`
29
25
  Runs all test files found within and beneath the current working directory.
30
26
 
@@ -41,6 +37,17 @@ instance, which then absorbs the modified test execution overhead into itself.
41
37
  `["quit"]`
42
38
  Stops all tests that are currently running and exits.
43
39
 
40
+ When testr-herald(1) reports that a file belonging to the test execution
41
+ overhead has been modified, this program replaces testr-master(1) with a new
42
+ instance, which then absorbs the modified test execution overhead into itself.
43
+
44
+ This program emits the following single-line status messages (JSON arrays) on
45
+ its standard output stream to provide notifications about its activity:
46
+
47
+ `["over",` *overhead_file*`]`
48
+ The test execution overhead is currently being reabsorbed, by replacing
49
+ testr-master(1) with a new instance, because *overhead_file* has changed.
50
+
44
51
  OPTIONS
45
52
  -------
46
53
 
@@ -68,7 +75,7 @@ testr(1), testr-driver(1), testr-master(1), testr-herald(1)
68
75
 
69
76
  =end =========================================================================
70
77
 
71
- $0 = File.basename(__FILE__)
78
+ $0 = File.basename(__FILE__) # for easier indentification in ps(1) output
72
79
 
73
80
  require 'binman'
74
81
  BinMan.help
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
3
 
4
- TESTR-HERALD 1 "2012-01-16" "14.2.0"
4
+ TESTR-HERALD 1 "2012-01-20" "14.3.0"
5
5
  ====================================
6
6
 
7
7
  NAME
@@ -33,7 +33,7 @@ testr(1), testr-driver(1), testr-master(1), testr-herald(1)
33
33
 
34
34
  =end =========================================================================
35
35
 
36
- $0 = File.basename(__FILE__)
36
+ $0 = File.basename(__FILE__) # for easier indentification in ps(1) output
37
37
 
38
38
  require 'binman'
39
39
  BinMan.help
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
3
 
4
- TESTR-MASTER 1 "2012-01-16" "14.2.0"
4
+ TESTR-MASTER 1 "2012-01-20" "14.3.0"
5
5
  ====================================
6
6
 
7
7
  NAME
@@ -75,7 +75,7 @@ testr(1), testr-driver(1), testr-master(1), testr-herald(1)
75
75
 
76
76
  =end =========================================================================
77
77
 
78
- $0 = File.basename(__FILE__)
78
+ $0 = File.basename(__FILE__) # for easier indentification in ps(1) output
79
79
 
80
80
  require 'binman'
81
81
  BinMan.help
@@ -1,9 +1,7 @@
1
1
  require 'testr/config'
2
2
 
3
- TestR::Config.after_fork_hooks << lambda {
4
- |worker_number, log_file, test_file, test_names|
5
-
3
+ TestR::Config.after_fork_hooks << proc do |worker_number|
6
4
  # for compatitibilty with parallel_tests gem,
7
5
  # store numbers as strings: "", "2", "3", "4"
8
6
  ENV['TEST_ENV_NUMBER'] = (worker_number + 1).to_s if worker_number > 0
9
- }
7
+ end
@@ -21,6 +21,12 @@ TestR::Config.test_file_globbers[%r<^(test|spec)/factories/.+_factory\.rb$>] =
21
21
  "{test,spec}/**/{#{base},#{poly}_*}_{test,spec}.rb"
22
22
  end
23
23
 
24
+ TestR::Config.after_fork_hooks << proc do
25
+ unless ActiveRecord::Base.connection_config[:database] == ':memory:'
26
+ ActiveRecord::Base.connection.reconnect!
27
+ end
28
+ end
29
+
24
30
  begin
25
31
  require 'rails/railtie'
26
32
  Class.new Rails::Railtie do
@@ -27,8 +27,8 @@ module Driver
27
27
  run_test_files @failed_test_files
28
28
  end
29
29
 
30
- def reabsorb_overhead_files very_first_time = false
31
- quit_herald_and_master unless very_first_time
30
+ def reabsorb_overhead_files
31
+ @master.quit if defined? @master
32
32
 
33
33
  @master = Client::Transceiver.new('testr-master') do |line|
34
34
  event, file, tests = JSON.load(line)
@@ -51,12 +51,18 @@ module Driver
51
51
  @failed_test_files.push file unless @failed_test_files.include? file
52
52
  end
53
53
 
54
- @upstream.print line
54
+ @client.print line
55
55
  end
56
56
 
57
57
  @master.send [:load, Config.overhead_load_paths,
58
58
  Dir[*Config.overhead_file_globs]]
59
59
 
60
+ rerun_running_test_files
61
+ end
62
+
63
+ def loop
64
+ reabsorb_overhead_files
65
+
60
66
  @herald = Client::Receiver.new('testr-herald') do |line|
61
67
  changed_file = line.chomp
62
68
  warn "testr-driver: herald: #{changed_file}" if $DEBUG
@@ -70,28 +76,20 @@ module Driver
70
76
 
71
77
  # reabsorb text execution overhead if overhead files changed
72
78
  if Config.reabsorb_file_greps.any? {|r| r =~ changed_file }
73
- @upstream.puts JSON.dump([:over, changed_file])
79
+ @client.puts JSON.dump([:over, changed_file])
74
80
  # NOTE: new thread because reabsorb_overhead_files will kill this one
75
81
  Thread.new { reabsorb_overhead_files }.join
76
82
  end
77
83
  end
78
84
 
79
- rerun_running_test_files
80
- end
81
-
82
- def loop
83
- reabsorb_overhead_files true
84
85
  super
85
- quit_herald_and_master
86
- end
87
86
 
88
- private
89
-
90
- def quit_herald_and_master
91
87
  @herald.quit
92
88
  @master.quit
93
89
  end
94
90
 
91
+ private
92
+
95
93
  @waiting_test_files = []
96
94
  @running_test_files = []
97
95
  @passed_test_files = []
@@ -17,7 +17,7 @@ module Master
17
17
  require file.sub(/\.rb$/, '')
18
18
  end
19
19
 
20
- @upstream.print @command_line
20
+ @client.print @command_line
21
21
  end
22
22
 
23
23
  def test test_file, test_names
@@ -57,7 +57,7 @@ module Master
57
57
  end
58
58
 
59
59
  @command_by_worker_pid[worker_pid] = @command.push(worker_number)
60
- @upstream.print @command_line
60
+ @client.print @command_line
61
61
  end
62
62
 
63
63
  def stop
@@ -77,7 +77,7 @@ private
77
77
  @worker_number_pool = (0 ... Config.max_forked_workers).to_a
78
78
  @command_by_worker_pid = {}
79
79
 
80
- # process exited child processes and report finished workers to upstream
80
+ # process exited child processes and report finished workers to client
81
81
  trap :SIGCHLD do
82
82
  begin
83
83
  while wait2_array = Process.wait2(-1, Process::WNOHANG)
@@ -85,7 +85,7 @@ private
85
85
  if command = @command_by_worker_pid.delete(child_pid)
86
86
  @worker_number_pool.push command.pop
87
87
  command[0] = child_status.success? ? 'pass' : 'fail'
88
- @upstream.puts JSON.dump(command.push(child_status))
88
+ @client.puts JSON.dump(command.push(child_status))
89
89
  else
90
90
  warn "testr-master: unknown child exited: #{wait2_array.inspect}"
91
91
  end
@@ -8,7 +8,7 @@ module Server
8
8
  end
9
9
 
10
10
  def loop
11
- (@upstream = STDOUT.dup).sync = true
11
+ (@client = STDOUT.dup).sync = true
12
12
  STDOUT.reopen(STDERR).sync = true
13
13
 
14
14
  catch :testr_server_quit do
@@ -1,3 +1,3 @@
1
1
  module TestR
2
- VERSION = "14.2.0"
2
+ VERSION = "14.3.0"
3
3
  end
@@ -1,4 +1,4 @@
1
- .TH TESTR\-DRIVER 1 "2012\-01\-16" "14.2.0"
1
+ .TH TESTR\-DRIVER 1 "2012\-01\-20" "14.3.0"
2
2
  .SH NAME
3
3
  .PP
4
4
  testr\-driver \- drives
@@ -14,14 +14,6 @@ standard input stream and performs the respective actions as described below.
14
14
  It also funnels the standard output stream of
15
15
  .BR testr\-master (1)
16
16
  into its own.
17
- .PP
18
- When
19
- .BR testr\-herald (1)
20
- reports that a file belonging to the test execution
21
- overhead has been modified, this program replaces
22
- .BR testr\-master (1)
23
- with a new
24
- instance, which then absorbs the modified test execution overhead into itself.
25
17
  .TP
26
18
  \fB\fC["run_all_test_files"]\fR
27
19
  Runs all test files found within and beneath the current working directory.
@@ -38,6 +30,22 @@ execution overhead, and resumes running those interrupted test files.
38
30
  .TP
39
31
  \fB\fC["quit"]\fR
40
32
  Stops all tests that are currently running and exits.
33
+ .PP
34
+ When
35
+ .BR testr\-herald (1)
36
+ reports that a file belonging to the test execution
37
+ overhead has been modified, this program replaces
38
+ .BR testr\-master (1)
39
+ with a new
40
+ instance, which then absorbs the modified test execution overhead into itself.
41
+ .PP
42
+ This program emits the following single\-line status messages (JSON arrays) on
43
+ its standard output stream to provide notifications about its activity:
44
+ .TP
45
+ \fB\fC["over",\fR \fIoverhead_file\fP\fB\fC]\fR
46
+ The test execution overhead is currently being reabsorbed, by replacing
47
+ .BR testr\-master (1)
48
+ with a new instance, because \fIoverhead_file\fP has changed.
41
49
  .SH OPTIONS
42
50
  .TP
43
51
  \fB\fC-h\fR, \fB\fC--help\fR
@@ -1,4 +1,4 @@
1
- .TH TESTR\-HERALD 1 "2012\-01\-16" "14.2.0"
1
+ .TH TESTR\-HERALD 1 "2012\-01\-20" "14.3.0"
2
2
  .SH NAME
3
3
  .PP
4
4
  testr\-herald \- reports modified files
@@ -1,4 +1,4 @@
1
- .TH TESTR\-MASTER 1 "2012\-01\-16" "14.2.0"
1
+ .TH TESTR\-MASTER 1 "2012\-01\-20" "14.3.0"
2
2
  .SH NAME
3
3
  .PP
4
4
  testr\-master \- absorbs overhead and runs tests
@@ -1,4 +1,4 @@
1
- .TH TESTR 1 "2012\-01\-16" "14.2.0"
1
+ .TH TESTR 1 "2012\-01\-20" "14.3.0"
2
2
  .SH NAME
3
3
  .PP
4
4
  testr \- Continuous testing tool for Ruby
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testr
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.2.0
4
+ version: 14.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,14 +10,16 @@ authors:
10
10
  - Daniel Pittman
11
11
  - Jacob Helwig
12
12
  - Corné Verbruggen
13
+ - Jose Pablo Barrantes
14
+ - Spencer Steffen
13
15
  autorequire:
14
16
  bindir: bin
15
17
  cert_chain: []
16
- date: 2012-01-17 00:00:00.000000000 Z
18
+ date: 2012-01-21 00:00:00.000000000 Z
17
19
  dependencies:
18
20
  - !ruby/object:Gem::Dependency
19
21
  name: binman
20
- requirement: &9134380 !ruby/object:Gem::Requirement
22
+ requirement: &20451640 !ruby/object:Gem::Requirement
21
23
  none: false
22
24
  requirements:
23
25
  - - ~>
@@ -25,10 +27,10 @@ dependencies:
25
27
  version: '3'
26
28
  type: :runtime
27
29
  prerelease: false
28
- version_requirements: *9134380
30
+ version_requirements: *20451640
29
31
  - !ruby/object:Gem::Dependency
30
32
  name: json
31
- requirement: &9133860 !ruby/object:Gem::Requirement
33
+ requirement: &20451120 !ruby/object:Gem::Requirement
32
34
  none: false
33
35
  requirements:
34
36
  - - ! '>='
@@ -39,10 +41,10 @@ dependencies:
39
41
  version: '2'
40
42
  type: :runtime
41
43
  prerelease: false
42
- version_requirements: *9133860
44
+ version_requirements: *20451120
43
45
  - !ruby/object:Gem::Dependency
44
46
  name: guard
45
- requirement: &9133120 !ruby/object:Gem::Requirement
47
+ requirement: &20450380 !ruby/object:Gem::Requirement
46
48
  none: false
47
49
  requirements:
48
50
  - - ! '>='
@@ -53,10 +55,10 @@ dependencies:
53
55
  version: '1'
54
56
  type: :runtime
55
57
  prerelease: false
56
- version_requirements: *9133120
58
+ version_requirements: *20450380
57
59
  - !ruby/object:Gem::Dependency
58
60
  name: diff-lcs
59
- requirement: &9132380 !ruby/object:Gem::Requirement
61
+ requirement: &20449640 !ruby/object:Gem::Requirement
60
62
  none: false
61
63
  requirements:
62
64
  - - ! '>='
@@ -67,7 +69,7 @@ dependencies:
67
69
  version: '2'
68
70
  type: :runtime
69
71
  prerelease: false
70
- version_requirements: *9132380
72
+ version_requirements: *20449640
71
73
  description: ''
72
74
  email:
73
75
  - sunaku@gmail.com
@@ -75,6 +77,8 @@ email:
75
77
  - daniel@rimspace.net
76
78
  - jacob@technosorcery.net
77
79
  - corne@g-majeur.nl
80
+ - xjpablobrx@gmail.com
81
+ - spencer@citrusme.com
78
82
  executables:
79
83
  - testr
80
84
  - testr-driver