Skip to content

Commit 1e16420

Browse files
committed
Improve tag_from_output to guess the file when there is no Ruby backtrace
* Frequent on JRuby where Java exceptions don't show a Ruby stacktrace.
1 parent 03ed009 commit 1e16420

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

tool/tag_from_output.rb

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,24 @@
2727
description = error_line.match(ERROR_OR_FAILED).pre_match
2828

2929
spec_file = rest.find { |line| line =~ SPEC_FILE }
30-
unless spec_file
31-
warn "Could not find file for:\n#{error_line}"
32-
next
30+
if spec_file
31+
spec_file = spec_file[SPEC_FILE, 1] or raise
32+
else
33+
if error_line =~ /^(\w+)#(\w+) /
34+
module_method = error_line.split(' ', 2).first
35+
file = "#{$1.downcase}/#{$2}_spec.rb"
36+
spec_file = ['spec/ruby/core', 'spec/ruby/library', *Dir.glob('spec/ruby/library/*')].find { |dir|
37+
path = "#{dir}/#{file}"
38+
break path if File.exist?(path)
39+
}
40+
end
41+
42+
unless spec_file
43+
warn "Could not find file for:\n#{error_line}"
44+
next
45+
end
3346
end
34-
spec_file = spec_file[SPEC_FILE, 1]
47+
3548
prefix = spec_file.index('spec/ruby/') || spec_file.index('spec/truffle/')
3649
spec_file = spec_file[prefix..-1]
3750

0 commit comments

Comments
 (0)