tork 19.11.1 → 20.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96f14406f95dcddafe9baa541a2ae220956c76f5
4
- data.tar.gz: fe2256cb537e4e0a947f96e8255769963ca2718d
3
+ metadata.gz: 988c5ed6c085e6de19928b5f04c85cea9bfbe6eb
4
+ data.tar.gz: b853a4b2203626de84ef575def8797fb08491f7b
5
5
  SHA512:
6
- metadata.gz: ea4534fb9de012f896e7444a8af834d380217dfdba07bbdbd4f15f49b86aca7d62e17315e31cf3043bf41ff3029dbbe41be43502c9444fabf0c30329e5d116cb
7
- data.tar.gz: 556b26331f1fa0e3067ec6ff809bd88f3cd0617e37844f5c247af007bbba9916987a573d5ffa716a25c8d3cc187793c5d014e69ee9dc251b573b2a3db987f596
6
+ metadata.gz: 495c35b54ac9bcae981101907bb412315e8bf2a31968808d0cb141028e85e2aceb881a65249d8c18ae2074e1a60e39fa6f5f0bfef6e60a8b49bf8692879c18d7
7
+ data.tar.gz: dc868b471d3c70a3b12ee6f79708ec988f81eae6cd002e554f129fdf3b47ca6ec87bc144da15474daeaf74457b0803000e8554a39353b51aec197008ba74471f
data/VERSION.markdown CHANGED
@@ -1,3 +1,58 @@
1
+ ## Version 20.0.0 (2014-10-26)
2
+
3
+ ### Major:
4
+
5
+ * tork-runner(1): percentage lied; print counts instead.
6
+
7
+ The percentage of completion is not accurate because it only measures
8
+ how many tests that have started running _so far_ have been completed.
9
+ This makes the percentage jump from 100% to lesser values as tests run.
10
+
11
+ Also drop the `tork-runner:` prefix from progress messages and replace
12
+ VT100 escape codes for reprinting in-place with a \r (carriage return).
13
+
14
+ * Shorten all status message tokens to ~4 characters.
15
+
16
+ * In tork-driver(1):
17
+ * `reabsorb` is now `over`
18
+
19
+ * In tork-engine(1):
20
+ * `idle` is now `done`
21
+ * `pass_now_fail` is now `fail!`
22
+ * `fail_now_pass` is now `pass!`
23
+
24
+ * In tork-master(1):
25
+ * `absorb` is now `boot`
26
+
27
+ * Shorten all commands names down to ~4 characters.
28
+
29
+ * In tork(1):
30
+ * the `o` input command character is now named `b`
31
+
32
+ * In tork-driver(1):
33
+ * the `run_all_test_files` command is now named `test!`
34
+ * the `over` message is now named `boot!`
35
+
36
+ * In tork-engine(1):
37
+ * the `reabsorb_overhead` command is now named `boot!`
38
+ * the `run_test_file` command is now named `test`
39
+ * the `run_test_files` command is now named `test`
40
+ * the `stop_running_test_files` command is now named `stop`
41
+ * the `rerun_passed_test_files` command is now named `pass!`
42
+ * the `rerun_failed_test_files` command is now named `fail!`
43
+ * the `list_failed_test_files` command is now named `fail?`
44
+ * the `over` status message is now named `boot!`
45
+
46
+ ### Minor:
47
+
48
+ * tork-engine(1): add `test?` and `pass?` listing commands.
49
+
50
+ * tork(1): emit "tork:" prefix on all messages sent to user.
51
+
52
+ ### Other:
53
+
54
+ * Upgrade to md2man 4.0 and binman 4.0.
55
+
1
56
  ## Version 19.11.1 (2014-10-24)
2
57
 
3
58
  This release improves support for RSpec 3 and Rails 4.
data/bin/tork CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # TORK 1 2014-10-24 19.11.1
4
+ # TORK 1 2014-10-26 20.0.0
5
5
 
6
6
  ## NAME
7
7
 
data/bin/tork-driver CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # TORK-DRIVER 1 2014-10-24 19.11.1
4
+ # TORK-DRIVER 1 2014-10-26 20.0.0
5
5
 
6
6
  ## NAME
7
7
 
@@ -25,7 +25,7 @@ stdin that are single-line JSON arrays, it splits each of them into an array
25
25
  of words, using the same word-splitting algorithm as sh(1), before processing
26
26
  them. For example, the line `a "b c"` is split into the `["a", "b c"]` array.
27
27
 
28
- `["run_all_test_files"]`
28
+ `["test!"]`
29
29
  Runs all test files found within and beneath the current working directory.
30
30
 
31
31
  *...*
@@ -36,9 +36,8 @@ them. For example, the line `a "b c"` is split into the `["a", "b c"]` array.
36
36
  This program prints the following messages, which are single-line JSON arrays,
37
37
  to stdout.
38
38
 
39
- `["reabsorb",` *overhead_file*`]`
40
- Test execution overhead is being reabsorbed because *overhead_file* has
41
- changed.
39
+ `["boot!",` *overhead_file*`]`
40
+ Reabsorbing test execution overhead because *overhead_file* has changed.
42
41
 
43
42
  *...*
44
43
  Messages from tork-engine(1) and tork-master(1) are also reproduced here.
data/bin/tork-engine CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # TORK-ENGINE 1 2014-10-24 19.11.1
4
+ # TORK-ENGINE 1 2014-10-26 20.0.0
5
5
 
6
6
  ## NAME
7
7
 
@@ -25,30 +25,34 @@ stdin that are single-line JSON arrays, it splits each of them into an array
25
25
  of words, using the same word-splitting algorithm as sh(1), before processing
26
26
  them. For example, the line `a "b c"` is split into the `["a", "b c"]` array.
27
27
 
28
- `["reabsorb_overhead"]`
28
+ `["boot!"]`
29
29
  Stops any test files that are currently running, reabsorbs the test
30
30
  execution overhead, and then re-runs those stopped test files.
31
31
 
32
- `["run_test_file"`, *test_file*`,` *line_numbers*...`]`
32
+ `["test"`, *test_file*`,` *line_numbers*...`]`
33
+ `["test"`, `[`*test_file*`,` *line_numbers*...`]`...`]`
33
34
  Runs tests that correspond to the given sequence of *line_numbers* in the
34
35
  given *test_file*. If no *line_numbers* are given, then only those lines
35
36
  that have changed since the last run of *test_file* will be substituted.
36
37
  If any *line_numbers* are zero, then the entire *test_file* will be run.
37
38
 
38
- `["run_test_files"`, *test\_files\_with\_optional\_line\_numbers*`]`
39
- Calls the `run_test_file` command once for each item in the given array.
39
+ `["test?"]`
40
+ Lists all test files that are currently running.
40
41
 
41
- `["stop_running_test_files"`, *signal*`]`
42
+ `["stop"`, *signal*`]`
42
43
  Stops test files that are currently running by sending the given *signal*
43
44
  (optional; defaults to "SIGTERM") to their respective worker processes.
44
45
 
45
- `["rerun_passed_test_files"]`
46
+ `["pass!"]`
46
47
  Runs all test files that have passed during their most recent run.
47
48
 
48
- `["rerun_failed_test_files"]`
49
+ `["pass?"]`
50
+ Lists all test files that have passed during their most recent run.
51
+
52
+ `["fail!"]`
49
53
  Runs all test files that have failed during their most recent run.
50
54
 
51
- `["list_failed_test_files"]`
55
+ `["fail?"]`
52
56
  Lists all test files that have failed during their most recent run.
53
57
 
54
58
  `["quit"]`
@@ -59,15 +63,15 @@ them. For example, the line `a "b c"` is split into the `["a", "b c"]` array.
59
63
  This program prints the following messages, which are single-line JSON arrays,
60
64
  to stdout.
61
65
 
62
- `["idle",` *ran_test_files*`,` *passed_test_files*`,` *failed_test_files*`]`
66
+ `["done",` *ran_test_files*`,` *passed_test_files*`,` *failed_test_files*`]`
63
67
  All queued tests have finished running and no new tests have been queued.
64
68
  In particular, *ran_test_files* test files have run, *passed_test_files*
65
69
  test files have passed, and *failed_test_files* test files have failed.
66
70
 
67
- `["pass_now_fail",` *test_file*`,` *message*`]`
71
+ `["fail!",` *test_file*`,` *message*`]`
68
72
  A previously passing *test_file* has now failed. See *message* for details.
69
73
 
70
- `["fail_now_pass",` *test_file*`,` *message*`]`
74
+ `["pass!",` *test_file*`,` *message*`]`
71
75
  A previously failing *test_file* has now passed. See *message* for details.
72
76
 
73
77
  *...*
data/bin/tork-herald CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # TORK-HERALD 1 2014-10-24 19.11.1
4
+ # TORK-HERALD 1 2014-10-26 20.0.0
5
5
 
6
6
  ## NAME
7
7
 
data/bin/tork-master CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # TORK-MASTER 1 2014-10-24 19.11.1
4
+ # TORK-MASTER 1 2014-10-26 20.0.0
5
5
 
6
6
  ## NAME
7
7
 
@@ -45,7 +45,7 @@ them. For example, the line `a "b c"` is split into the `["a", "b c"]` array.
45
45
  This program prints the following messages, which are single-line JSON arrays,
46
46
  to stdout.
47
47
 
48
- `["absorb"]`
48
+ `["boot"]`
49
49
  Test execution overhead has been absorbed. We are ready for testing!
50
50
 
51
51
  `["test",` *test_file*`,` *line_numbers*`,` *log_file*`,` *worker_number*`]`
data/bin/tork-notify CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # TORK-NOTIFY 1 2014-10-24 19.11.1
4
+ # TORK-NOTIFY 1 2014-10-26 20.0.0
5
5
 
6
6
  ## NAME
7
7
 
@@ -46,8 +46,8 @@ IO.popen('tork-remote tork-engine', 'r+') do |remote|
46
46
  # make notifications edge-triggered: pass => fail or vice versa.
47
47
  # we do not care about pass => pass or fail => fail transitions.
48
48
  icon = case event.to_sym
49
- when :fail_now_pass then 'dialog-information'
50
- when :pass_now_fail then 'dialog-error'
49
+ when :pass! then 'dialog-information'
50
+ when :fail! then 'dialog-error'
51
51
  end
52
52
 
53
53
  if icon
data/bin/tork-runner CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # TORK-RUNNER 1 2014-10-24 19.11.1
4
+ # TORK-RUNNER 1 2014-10-26 20.0.0
5
5
 
6
6
  ## NAME
7
7
 
@@ -30,8 +30,8 @@ This program prints the following messages to stdout.
30
30
 
31
31
  This program prints the following messages to stderr if it is a TTY device.
32
32
 
33
- `tork-runner:` *NN.N*`% tested`
34
- *NN.N* percent of test files were tested so far.
33
+ *T* `tested,` *P* `passed,` *F* `failed`
34
+ So far, *T* test files were tested, *P* of them passed, *F* of them failed.
35
35
 
36
36
  ## OPTIONS
37
37
 
@@ -68,13 +68,13 @@ IO.popen('tork-driver', 'w+') do |driver|
68
68
  test_files = Dir[*ARGV]
69
69
  command =
70
70
  if test_files.empty?
71
- [:run_all_test_files]
71
+ [:test!]
72
72
  else
73
- [:run_test_files, test_files]
73
+ [:test, test_files]
74
74
  end
75
75
  driver.puts JSON.dump(command)
76
76
 
77
- # track test runs & exit when finished
77
+ # track test runs and show the progress
78
78
  tested, passed, failed = 0, 0, []
79
79
  while line = driver.gets
80
80
  response = JSON.parse(line)
@@ -82,15 +82,22 @@ IO.popen('tork-driver', 'w+') do |driver|
82
82
  when :test then tested += 1
83
83
  when :pass then passed += 1
84
84
  when :fail then failed << response[3]
85
- when :idle then
86
- puts failed.map {|log| [nil, ">> #{log} <<", File.read(log)] }, nil,
87
- "#{tested} tested, #{passed} passed, #{failed.count} failed"
88
- exit! failed.empty?
85
+ when :done then break
89
86
  end
90
87
 
91
- # tell user how many tests (percentage) have finished running;
92
- # see http://www.termsys.demon.co.uk/vtansi.htm for ANSI VT100
93
- STDERR.printf "\e[s\e[K%s: %02.1f%% tested\e[u", $0,
94
- ((passed + failed.count) / tested.to_f) * 100 if STDERR.tty?
88
+ progress = "#{tested} tested, #{passed} passed, #{failed.length} failed"
89
+ #
90
+ # show testing progress if we are connected to a terminal device
91
+ #
92
+ # NOTE: \r (carriage return) moves cursor to beginning of line so we end
93
+ # up overwriting any previously printed progress message; we don't
94
+ # need to erase the line because message length is non-decreasing:
95
+ # i.e. the counts shown in the message can only increase over time
96
+ #
97
+ STDERR.print "\r", progress if STDERR.tty?
95
98
  end
99
+
100
+ # report failures and exit accordingly
101
+ puts failed.map {|log| [nil, ">> #{log} <<", File.read(log)] }, nil, progress
102
+ exit! failed.empty?
96
103
  end
data/lib/tork/cliapp.rb CHANGED
@@ -4,7 +4,7 @@ module Tork
4
4
  class CLIApp < Server
5
5
 
6
6
  def loop
7
- tell @clients, 'Absorbing test execution overhead...', false
7
+ tell @clients, 'Absorbing test execution overhead...'
8
8
  @driver = popen('tork-driver')
9
9
  super
10
10
  ensure
@@ -22,17 +22,20 @@ protected
22
22
  Regexp.union(File.expand_path('../../..', __FILE__), TORK_DOLLAR_ZERO)
23
23
  }[^:]*:\d+:.+$/
24
24
 
25
+ # remove Ruby's built-in Kernel#test() method so our test() method works
26
+ undef test
27
+
25
28
  def recv client, message
26
29
  case client
27
30
  when @driver
28
31
  event, *details = message
29
32
 
30
33
  case event_sym = event.to_sym
31
- when :absorb
32
- tell @clients, 'Overhead absorbed. Ready for testing!', false
34
+ when :boot
35
+ tell @clients, 'Test execution overhead absorbed; ready to test!'
33
36
 
34
- when :reabsorb
35
- tell @clients, 'Reabsorbing changed overhead files...', false
37
+ when :boot!
38
+ tell @clients, 'Test execution overhead changed; re-absorbing...'
36
39
 
37
40
  when :test, :pass, :fail
38
41
  test_file, line_numbers, log_file, worker_number, exit_status = details
@@ -53,17 +56,18 @@ protected
53
56
 
54
57
  tell @clients, message, false
55
58
 
56
- when :idle
59
+ when :done
57
60
  tested, passed, failed = details.map(&:length)
58
61
  tell @clients, "#{tested} tested, #{passed} passed, #{failed} failed"
59
62
  end
63
+
60
64
  else
61
65
  key = message.shift.lstrip[0,1].downcase
62
66
  cmd = Array(COMMANDS.fetch(key, [:help, client])) + message
63
67
  if respond_to? cmd.first, true
64
68
  __send__(*cmd)
65
69
  else
66
- tell @clients, "Sending #{cmd.inspect} command...", false
70
+ tell @clients, "Sending #{cmd.inspect} command..."
67
71
  send @driver, cmd
68
72
  end
69
73
  end
@@ -72,27 +76,27 @@ protected
72
76
  private
73
77
 
74
78
  COMMANDS = {
75
- 't' => :run_test_file,
76
- 'a' => :run_all_test_files,
77
- 's' => :stop_running_test_files,
78
- 'k' => [:stop_running_test_files, :SIGKILL],
79
- 'p' => :rerun_passed_test_files,
80
- 'f' => :rerun_failed_test_files,
81
- 'l' => :list_failed_test_files,
82
- 'o' => :reabsorb_overhead,
79
+ 't' => :test,
80
+ 'a' => :test!,
81
+ 's' => :stop,
82
+ 'k' => [:stop, :SIGKILL],
83
+ 'p' => :pass!,
84
+ 'f' => :fail!,
85
+ 'l' => :fail?,
86
+ 'b' => :boot!,
83
87
  'q' => :quit,
84
88
  }
85
89
 
86
90
  def help client
87
- tell client, <<HELP, false
88
- Type a then ENTER to run all test files.
91
+ tell client, <<HELP
92
+ Type a then ENTER to run all available test files.
89
93
  Type t then SPACE then a filename then ENTER to run a specific test file.
90
94
  Type s then ENTER to stop currently running test files.
91
95
  Type k then ENTER to kill currently running test files.
92
96
  Type p then ENTER to re-run currently passing test files.
93
97
  Type f then ENTER to re-run currently failing test files.
94
98
  Type l then ENTER to list currently failing test files.
95
- Type o then ENTER to re-absorb test execution overhead.
99
+ Type b then ENTER to re-absorb test execution overhead.
96
100
  Type h then ENTER to see this help message.
97
101
  Type q then ENTER to quit.
98
102
  HELP
data/lib/tork/driver.rb CHANGED
@@ -25,11 +25,11 @@ class Driver < Server
25
25
  pclose @engine
26
26
  end
27
27
 
28
- def run_all_test_files
28
+ def test!
29
29
  test_files_found = false
30
30
  Dir.glob(ALL_TEST_FILE_GLOBS) do |test_file|
31
31
  next if overhead_file? test_file
32
- run_test_file test_file
32
+ test test_file
33
33
  test_files_found = true
34
34
  end
35
35
  tell @client, 'There are no test files to run.' unless test_files_found
@@ -59,8 +59,8 @@ protected
59
59
 
60
60
  # reabsorb text execution overhead if overhead files changed
61
61
  if overhead_file? changed_file
62
- send @clients, [:reabsorb, changed_file]
63
- reabsorb_overhead
62
+ send @clients, [:boot!, changed_file]
63
+ boot!
64
64
  else
65
65
  run_non_overhead_test_files find_dependent_test_files(changed_file)
66
66
  end
@@ -74,7 +74,7 @@ protected
74
74
  private
75
75
 
76
76
  def run_non_overhead_test_files test_files
77
- run_test_files test_files.reject {|f| overhead_file? f }
77
+ test test_files.reject {|f| overhead_file? f }
78
78
  end
79
79
 
80
80
  def overhead_file? file
data/lib/tork/engine.rb CHANGED
@@ -25,18 +25,22 @@ class Engine < Server
25
25
  pclose @master
26
26
  end
27
27
 
28
- def reabsorb_overhead
28
+ def boot!
29
29
  @master.reconnect
30
30
 
31
31
  # resume running all previously running test files and
32
32
  # all previously failed test files in the new master
33
- resume = @running_test_files + @failed_test_files
33
+ resumable = @running_test_files + @failed_test_files
34
34
  @running_test_files.clear
35
- run_test_files resume
35
+ test resumable
36
36
  end
37
37
 
38
- def run_test_file test_file, *line_numbers
39
- if File.exist? test_file and @running_test_files.add? test_file
38
+ def test test_file, *line_numbers
39
+ # a list of tests was passed in for the first argument
40
+ if test_file.respond_to? :each and line_numbers.empty?
41
+ test_file.each {|args| test(*args) }
42
+
43
+ elsif File.exist? test_file and @running_test_files.add? test_file
40
44
  if line_numbers.empty?
41
45
  line_numbers = find_changed_line_numbers(test_file)
42
46
  else
@@ -47,11 +51,15 @@ class Engine < Server
47
51
  end
48
52
  end
49
53
 
50
- def run_test_files test_files_with_optional_line_numbers
51
- test_files_with_optional_line_numbers.each {|f| run_test_file(*f) }
54
+ def test?
55
+ if @running_test_files.empty?
56
+ tell @client, 'There are no running test files to list.'
57
+ else
58
+ tell @client, @running_test_files.sort, false
59
+ end
52
60
  end
53
61
 
54
- def stop_running_test_files signal=nil
62
+ def stop signal=nil
55
63
  if @running_test_files.empty?
56
64
  tell @client, 'There are no running test files to stop.'
57
65
  else
@@ -60,23 +68,31 @@ class Engine < Server
60
68
  end
61
69
  end
62
70
 
63
- def rerun_passed_test_files
71
+ def pass!
64
72
  if @passed_test_files.empty?
65
73
  tell @client, 'There are no passed test files to re-run.'
66
74
  else
67
- run_test_files @passed_test_files
75
+ test @passed_test_files
76
+ end
77
+ end
78
+
79
+ def pass?
80
+ if @passed_test_files.empty?
81
+ tell @client, 'There are no passed test files to list.'
82
+ else
83
+ tell @client, @passed_test_files.sort, false
68
84
  end
69
85
  end
70
86
 
71
- def rerun_failed_test_files
87
+ def fail!
72
88
  if @failed_test_files.empty?
73
89
  tell @client, 'There are no failed test files to re-run.'
74
90
  else
75
- run_test_files @failed_test_files
91
+ test @failed_test_files
76
92
  end
77
93
  end
78
94
 
79
- def list_failed_test_files
95
+ def fail?
80
96
  if @failed_test_files.empty?
81
97
  tell @client, 'There are no failed test files to list.'
82
98
  else
@@ -100,14 +116,14 @@ protected
100
116
  @recently_failed_test_files.add file
101
117
  was_pass = @passed_test_files.delete? file
102
118
  now_fail = @failed_test_files.add? file
103
- send @clients, [:pass_now_fail, file, message] if was_pass and now_fail
119
+ send @clients, [:fail!, file, message] if was_pass and now_fail
104
120
 
105
121
  elsif line_numbers.empty?
106
122
  # only whole test file runs should qualify as pass
107
123
  @recently_passed_test_files.add file
108
124
  was_fail = @failed_test_files.delete? file
109
125
  now_pass = @passed_test_files.add? file
110
- send @clients, [:fail_now_pass, file, message] if was_fail and now_pass
126
+ send @clients, [:pass!, file, message] if was_fail and now_pass
111
127
  end
112
128
 
113
129
  # notify user when all test files have finished running
@@ -119,7 +135,7 @@ protected
119
135
  @recently_failed_test_files.clear
120
136
 
121
137
  tested = passed + failed
122
- send @clients, [:idle, tested, passed, failed]
138
+ send @clients, [:done, tested, passed, failed]
123
139
  end
124
140
  end
125
141