grntest 1.6.0 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +13 -0
- data/lib/grntest/reporters/base-reporter.rb +20 -5
- data/lib/grntest/reporters/stream-reporter.rb +39 -15
- data/lib/grntest/tester.rb +25 -2
- data/lib/grntest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 738937a2c9b0aaaaca52666b1e473316e8061d723089088a354ba5866b74f09f
|
4
|
+
data.tar.gz: 130ba969e61ea492878c06fbce47b8d1dbf9eaefcbc1af8d8c34bec99c26b46f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65b744a5acd3abcce3904eb9ce012815659f02938987af6e90d449df161725630864c299f47e7ccc0fc8779bd095293459c7a446a55aa50775b96ade2337de01
|
7
|
+
data.tar.gz: 9af7a26b36f338e4da106dedc330d14a80e30043bd5ef0a8b2c247f8403957d30ad2dde25113a4a61488d2d4ce26f654b4e17de4323373006091d4640a65828c
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.6.2: 2023-08-24
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* reporter: stream: Changed to show "start" message in multi-workers
|
8
|
+
mode.
|
9
|
+
|
10
|
+
## 1.6.1: 2023-08-11
|
11
|
+
|
12
|
+
### Improvements
|
13
|
+
|
14
|
+
* `--n-workers`: Use the max number of cores by default.
|
15
|
+
|
3
16
|
## 1.6.0: 2023-07-21
|
4
17
|
|
5
18
|
### Improvements
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2012-
|
1
|
+
# Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -28,11 +28,19 @@ module Grntest
|
|
28
28
|
|
29
29
|
private
|
30
30
|
def synchronize
|
31
|
-
|
31
|
+
if single_worker?
|
32
32
|
yield
|
33
|
+
else
|
34
|
+
@mutex.synchronize do
|
35
|
+
yield
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
40
|
+
def single_worker?
|
41
|
+
@tester.n_workers == 1
|
42
|
+
end
|
43
|
+
|
36
44
|
def report_summary(result)
|
37
45
|
puts(statistics_header)
|
38
46
|
puts(colorize(statistics(result), result))
|
@@ -120,16 +128,19 @@ module Grntest
|
|
120
128
|
reporter.report
|
121
129
|
end
|
122
130
|
|
131
|
+
def report_full_test_name(worker)
|
132
|
+
print("#{worker.suite_name}/#{worker.test_name}")
|
133
|
+
end
|
134
|
+
|
123
135
|
def report_test(worker, result)
|
124
136
|
report_marker(result)
|
125
|
-
print("[#{worker.id}] ") if
|
137
|
+
print("[#{worker.id}] ") if single_worker?
|
126
138
|
puts(worker.suite_name)
|
127
139
|
print(" #{worker.test_name}")
|
128
140
|
report_test_result(result, worker.status)
|
129
141
|
end
|
130
142
|
|
131
|
-
def
|
132
|
-
message = test_result_message(result, label)
|
143
|
+
def report_right_message(message)
|
133
144
|
message_width = string_width(message)
|
134
145
|
rest_width = @term_width - @current_column
|
135
146
|
if rest_width > message_width
|
@@ -138,6 +149,10 @@ module Grntest
|
|
138
149
|
puts(message)
|
139
150
|
end
|
140
151
|
|
152
|
+
def report_test_result(result, label)
|
153
|
+
report_right_message(test_result_message(result, label))
|
154
|
+
end
|
155
|
+
|
141
156
|
def test_result_message(result, label)
|
142
157
|
elapsed_time = result.elapsed_time
|
143
158
|
formatted_elapsed_time = "%.4fs" % elapsed_time
|
@@ -1,6 +1,4 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
|
4
2
|
#
|
5
3
|
# This program is free software: you can redistribute it and/or modify
|
6
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -31,6 +29,7 @@ module Grntest
|
|
31
29
|
end
|
32
30
|
|
33
31
|
def on_suite_start(worker)
|
32
|
+
return unless single_worker?
|
34
33
|
if worker.suite_name.bytesize <= @term_width
|
35
34
|
puts(worker.suite_name)
|
36
35
|
else
|
@@ -40,36 +39,61 @@ module Grntest
|
|
40
39
|
end
|
41
40
|
|
42
41
|
def on_test_start(worker)
|
43
|
-
|
44
|
-
|
42
|
+
synchronize do
|
43
|
+
if single_worker?
|
44
|
+
print(" #{worker.test_name}")
|
45
|
+
else
|
46
|
+
report_full_test_name(worker)
|
47
|
+
report_right_message("[start]")
|
48
|
+
end
|
49
|
+
@output.flush
|
50
|
+
end
|
45
51
|
end
|
46
52
|
|
47
53
|
def on_test_success(worker, result)
|
48
|
-
|
54
|
+
synchronize do
|
55
|
+
report_full_test_name(worker) unless single_worker?
|
56
|
+
report_test_result(result, worker.status)
|
57
|
+
end
|
49
58
|
end
|
50
59
|
|
51
60
|
def on_test_failure(worker, result)
|
52
|
-
|
53
|
-
|
61
|
+
synchronize do
|
62
|
+
report_full_test_name(worker) unless single_worker?
|
63
|
+
report_test_result(result, worker.status)
|
64
|
+
report_failure(result)
|
65
|
+
end
|
54
66
|
end
|
55
67
|
|
56
68
|
def on_test_leak(worker, result)
|
57
|
-
|
58
|
-
|
69
|
+
synchronize do
|
70
|
+
report_full_test_name(worker) unless single_worker?
|
71
|
+
report_test_result(result, worker.status)
|
72
|
+
report_actual(result) unless result.checked?
|
73
|
+
end
|
59
74
|
end
|
60
75
|
|
61
76
|
def on_test_omission(worker, result)
|
62
|
-
|
63
|
-
|
77
|
+
synchronize do
|
78
|
+
report_full_test_name(worker) unless single_worker?
|
79
|
+
report_test_result(result, worker.status)
|
80
|
+
report_actual(result)
|
81
|
+
end
|
64
82
|
end
|
65
83
|
|
66
84
|
def on_test_omission_suppressed(worker, result)
|
67
|
-
|
85
|
+
synchronize do
|
86
|
+
report_full_test_name(worker) unless single_worker?
|
87
|
+
report_test_result(result, worker.status)
|
88
|
+
end
|
68
89
|
end
|
69
90
|
|
70
91
|
def on_test_no_check(worker, result)
|
71
|
-
|
72
|
-
|
92
|
+
synchronize do
|
93
|
+
report_full_test_name(worker) unless single_worker?
|
94
|
+
report_test_result(result, worker.status)
|
95
|
+
report_actual(result)
|
96
|
+
end
|
73
97
|
end
|
74
98
|
|
75
99
|
def on_test_finish(worker, result)
|
data/lib/grntest/tester.rb
CHANGED
@@ -199,7 +199,8 @@ module Grntest
|
|
199
199
|
end
|
200
200
|
|
201
201
|
parser.on("--n-workers=N", Integer,
|
202
|
-
"Use N workers to run tests"
|
202
|
+
"Use N workers to run tests",
|
203
|
+
"(#{tester.n_workers})") do |n|
|
203
204
|
tester.n_workers = n
|
204
205
|
end
|
205
206
|
|
@@ -382,7 +383,7 @@ module Grntest
|
|
382
383
|
@base_directory = Pathname(".")
|
383
384
|
@database_path = nil
|
384
385
|
@reporter = nil
|
385
|
-
@n_workers =
|
386
|
+
@n_workers = guess_n_cores
|
386
387
|
@output = $stdout
|
387
388
|
@keep_database = false
|
388
389
|
@use_color = nil
|
@@ -544,6 +545,28 @@ module Grntest
|
|
544
545
|
runner.run(test_suites)
|
545
546
|
end
|
546
547
|
|
548
|
+
def guess_n_cores
|
549
|
+
begin
|
550
|
+
if command_exist?("nproc")
|
551
|
+
# Linux
|
552
|
+
Integer(`nproc`.strip, 10)
|
553
|
+
elsif command_exist?("sysctl")
|
554
|
+
# macOS
|
555
|
+
Integer(`sysctl -n hw.logicalcpu`.strip, 10)
|
556
|
+
else
|
557
|
+
# Windows
|
558
|
+
value = ENV["NUMBER_OF_PROCESSORS"]
|
559
|
+
if value
|
560
|
+
Integer(value, 10)
|
561
|
+
else
|
562
|
+
1
|
563
|
+
end
|
564
|
+
end
|
565
|
+
rescue ArgumentError
|
566
|
+
1
|
567
|
+
end
|
568
|
+
end
|
569
|
+
|
547
570
|
def detect_suitable_diff
|
548
571
|
if command_exist?("cut-diff")
|
549
572
|
@diff = "cut-diff"
|
data/lib/grntest/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grntest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-08-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: diff-lcs
|