Skip to content

Commit 845cfe3

Browse files
committed
[GR-25195] JT: show timings for each .sh test script
PullRequest: truffleruby/2055
2 parents 7f2310b + 0620e54 commit 845cfe3

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

tool/jt.rb

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ def retag(*args)
11931193
env = {}
11941194
env['TRUFFLERUBYOPT'] = [*ENV['TRUFFLERUBYOPT'], '--experimental-options', '--exceptions-print-java=true'].join(' ')
11951195

1196-
select_tests('test/truffle/compiler', args).each do |test_script|
1196+
run_tests('test/truffle/compiler', args) do |test_script|
11971197
sh env, test_script
11981198
end
11991199
end
@@ -1291,7 +1291,7 @@ def retag(*args)
12911291
end
12921292
end
12931293

1294-
private def select_tests(tests_path, tests)
1294+
private def run_tests(tests_path, tests)
12951295
tests_path = "#{TRUFFLERUBY_DIR}/#{tests_path}"
12961296
test_names = tests.empty? ? '*' : '{' + tests.join(',') + '}'
12971297

@@ -1303,27 +1303,38 @@ def retag(*args)
13031303
exit 1
13041304
end
13051305

1306-
candidates
1306+
STDERR.puts
1307+
candidates.each do |test_script|
1308+
STDERR.puts "[jt] Running #{test_script} ..."
1309+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
1310+
begin
1311+
yield test_script
1312+
ensure
1313+
finish = Process.clock_gettime(Process::CLOCK_MONOTONIC)
1314+
duration = finish - start
1315+
STDERR.puts "[jt] #{test_script} took #{'%.1f' % duration}s\n\n\n"
1316+
end
1317+
end
13071318
end
13081319

13091320
private def test_integration(*args)
1310-
select_tests('test/truffle/integration', args).each do |test_script|
1321+
run_tests('test/truffle/integration', args) do |test_script|
13111322
sh test_script
13121323
end
13131324
end
13141325

13151326
private def test_gems(*args)
13161327
gem_test_pack
13171328

1318-
select_tests('test/truffle/gems', args).each do |test_script|
1329+
run_tests('test/truffle/gems', args) do |test_script|
13191330
sh test_script
13201331
end
13211332
end
13221333

13231334
private def test_ecosystem(*args)
13241335
gem_test_pack if gem_test_pack?
13251336

1326-
select_tests('test/truffle/ecosystem', args).each do |test_script|
1337+
run_tests('test/truffle/ecosystem', args) do |test_script|
13271338
sh test_script, *(gem_test_pack if gem_test_pack?)
13281339
end
13291340
end

0 commit comments

Comments
 (0)