Skip to content

Commit 300fdb3

Browse files
committed
Add jacoco option to jt to produce coverage results
1 parent f8b272f commit 300fdb3

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,7 @@ doc/user/README.md
9898

9999
# Ignore .rb files at the root, it's temporary files to debug some issue
100100
/*.rb
101+
102+
# Jacoco
103+
jacoco.exec
104+
/coverage/

mx.truffleruby/mx_truffleruby.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
# GNU General Public License version 2, or
77
# GNU Lesser General Public License version 2.1.
88

9+
from __future__ import print_function
10+
911
import os
1012
import pipes
1113
from os.path import join, exists, basename
1214

1315
import mx
16+
import mx_gate
1417
import mx_sdk
1518
import mx_subst
1619
import mx_spotbugs
@@ -129,6 +132,10 @@ def ruby_run_specs(ruby, args):
129132
with VerboseMx():
130133
jt('--use', ruby, 'test', 'specs', *args)
131134

135+
def ruby_jacoco_args(args):
136+
mx_gate.add_jacoco_whitelisted_packages(['org.truffleruby'])
137+
print(' '.join(mx_gate.get_jacoco_agent_args('append')))
138+
132139
def ruby_testdownstream_hello(args):
133140
"""Run a minimal Hello World test"""
134141
build_truffleruby([])
@@ -255,4 +262,5 @@ def verify_ci(args):
255262
'ruby_testdownstream_sulong': [ruby_testdownstream_sulong, ''],
256263
'ruby_spotbugs': [ruby_spotbugs, ''],
257264
'verify-ci' : [verify_ci, '[options]'],
265+
'ruby_jacoco_args': [ruby_jacoco_args, ''],
258266
})

mx.truffleruby/suite.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
suite = {
2-
"mxversion": "5.258.2",
2+
"mxversion": "5.275.3",
33
"name": "truffleruby",
44

55
"imports": {
@@ -108,6 +108,7 @@
108108
"org.truffleruby.annotations": {
109109
"dir": "src/annotations",
110110
"sourceDirs": ["java"],
111+
"jacoco": "include",
111112
"javaCompliance": "8+",
112113
"checkstyle": "org.truffleruby",
113114
"workingSets": "TruffleRuby",
@@ -125,6 +126,7 @@
125126
"annotationProcessors": [
126127
"TRUFFLERUBY-PROCESSOR",
127128
],
129+
"jacoco": "include",
128130
"javaCompliance": "8+",
129131
"checkstyle": "org.truffleruby",
130132
"workingSets": "TruffleRuby",
@@ -139,6 +141,7 @@
139141
"truffleruby:TRUFFLERUBY-ANNOTATIONS",
140142
"truffle:TRUFFLE_API",
141143
],
144+
"jacoco": "include",
142145
"javaCompliance": "8+",
143146
"checkstyle": "org.truffleruby",
144147
"workingSets": "TruffleRuby",
@@ -152,6 +155,7 @@
152155
"dependencies": [
153156
"sdk:GRAAL_SDK",
154157
],
158+
"jacoco": "include",
155159
"javaCompliance": "8+",
156160
"checkstyle": "org.truffleruby",
157161
"workingSets": "TruffleRuby",
@@ -175,6 +179,7 @@
175179
"truffle:TRUFFLE_DSL_PROCESSOR",
176180
"TRUFFLERUBY-PROCESSOR",
177181
],
182+
"jacoco": "include",
178183
"javaCompliance": "8+",
179184
"checkstyle": "org.truffleruby",
180185
"workingSets": "TruffleRuby",
@@ -215,6 +220,7 @@
215220
"sdk:GRAAL_SDK",
216221
"sdk:LAUNCHER_COMMON",
217222
],
223+
"jacoco": "include",
218224
"javaCompliance": "8+",
219225
"checkstyle": "org.truffleruby",
220226
"workingSets": "TruffleRuby",

tool/jt.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,8 @@ def rebuild(*options)
847847
args.unshift '--check-compilation'
848848
when '--asm'
849849
vm_args += %w[--vm.XX:+UnlockDiagnosticVMOptions --vm.XX:CompileCommand=print,*::callRoot]
850+
when '--jacoco'
851+
vm_args << jacoco_args
850852
when '--jdebug'
851853
vm_args << JDEBUG
852854
when '--jexception', '--jexceptions'
@@ -1198,6 +1200,11 @@ def retag(*args)
11981200
end
11991201
end
12001202

1203+
private def jacoco_args
1204+
out = mx('ruby_jacoco_args', '--quiet', '--no-warning', capture: :out).lines.last.chomp
1205+
out.sub('-', '--vm.')
1206+
end
1207+
12011208
private def test_cexts(*args)
12021209
all_tests = %w(tools minimum method module globals backtraces xopenssl postinstallhook gems)
12031210
no_openssl = args.delete('--no-openssl')

0 commit comments

Comments
 (0)