Skip to content

Commit

Permalink
[Truffle] Tag mri test errors add tagging script
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Fish committed Nov 17, 2016
1 parent d493e0d commit 0d84c97
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/mri/excludes_truffle/TC_OpenStruct.rb
Expand Up @@ -5,3 +5,5 @@
exclude :test_equality, "needs investigation"
exclude :test_frozen, "needs investigation"
exclude :test_getter, "needs investigation"
exclude :"test_respond_to_allocated", "needs investigation"
exclude :test_accessor_defines_method, "needs investigation"
1 change: 1 addition & 0 deletions test/mri/excludes_truffle/TestBeginEndBlock.rb
Expand Up @@ -11,3 +11,4 @@
exclude :test_raise_in_at_exit, "needs investigation"
exclude :test_rescue_at_exit, "needs investigation"
exclude :"test_endblockwarn_in_eval", "needs investigation"
exclude :"test_errinfo_at_exit", "needs investigation"
1 change: 1 addition & 0 deletions test/mri/excludes_truffle/TestDir_M17N.rb
Expand Up @@ -17,3 +17,4 @@
exclude :"test_glob_warning_match_dir", "needs investigation"
exclude :test_glob_warning_opendir, "needs investigation"
exclude :test_pwd, "needs investigation"
exclude :"test_glob_encoding", "needs investigation"
4 changes: 4 additions & 0 deletions test/mri/excludes_truffle/TestException.rb
Expand Up @@ -36,3 +36,7 @@
exclude :"test_name_error_local_variables", "needs investigation"
exclude :"test_output_string_encoding", "needs investigation"
exclude :"test_uncaught_throw", "needs investigation"
exclude :"test_cause_at_raised", "needs investigation"
exclude :"test_cause_raised_in_rescue", "needs investigation"
exclude :"test_name_error_info_parent_iseq_mark", "needs investigation"
exclude :"test_raise_with_cause_in_rescue", "needs investigation"
3 changes: 3 additions & 0 deletions test/mri/excludes_truffle/TestRubyOptimization.rb
Expand Up @@ -32,3 +32,6 @@
exclude :"test_eqq", "needs investigation"
exclude :"test_opt_case_dispatch", "needs investigation"
exclude :"test_string_freeze_block", "needs investigation"
exclude :"test_nil_safe_conditional_assign", "needs investigation"
exclude :"test_tailcall_inhibited_by_block", "needs investigation"
exclude :"test_tailcall_inhibited_by_rescue", "needs investigation"
1 change: 1 addition & 0 deletions test/mri/excludes_truffle/TestStringIO.rb
Expand Up @@ -46,3 +46,4 @@
exclude :"test_sysread", "needs investigation"
exclude :"test_ungetbyte_padding", "needs investigation"
exclude :"test_ungetc_padding", "needs investigation"
exclude :"test_binmode", "needs investigation"
1 change: 1 addition & 0 deletions test/mri/excludes_truffle/TestStruct/SubStruct.rb
Expand Up @@ -9,3 +9,4 @@
exclude :test_struct_new, "needs investigation"
exclude :test_values_at, "needs investigation"
exclude :test_big_struct, "needs investigation"
exclude :"test_new_dupilicate", "needs investigation"
1 change: 1 addition & 0 deletions test/mri/excludes_truffle/TestStruct/TopStruct.rb
Expand Up @@ -8,3 +8,4 @@
exclude :test_struct_new, "needs investigation"
exclude :test_values_at, "needs investigation"
exclude :test_big_struct, "needs investigation"
exclude :"test_new_dupilicate", "needs investigation"
2 changes: 2 additions & 0 deletions test/mri/excludes_truffle/TestSymbol.rb
Expand Up @@ -11,3 +11,5 @@
exclude :"test_to_proc_new_proc", "needs investigation"
exclude :"test_to_proc_no_method", "needs investigation"
exclude :"test_to_proc_yield", "needs investigation"
exclude :"test_to_proc_binding", "needs investigation"
exclude :"test_to_proc_iseq", "needs investigation"
1 change: 1 addition & 0 deletions test/mri/excludes_truffle/TestTime.rb
Expand Up @@ -42,3 +42,4 @@
exclude :test_utc_p, "needs investigation"
exclude :test_time_subt, "needs investigation"
exclude :"test_zone", "needs investigation"
exclude :"test_strftime_year", "needs investigation"
71 changes: 71 additions & 0 deletions tool/truffle/parse_mri_errors.rb
@@ -0,0 +1,71 @@
file = File.open("../../../jruby-patches/test_output_more.txt", "rb")
contents = file.read

## Expirimental MRI test tagging script
## Needs to be run from the jruby/test/mri directory
## Error console output read from the file path above

## Usage
## E.g.
# Create txt file with MRI test output into the file and set the path above
# cd test/mri
# ruby ../../tool/truffle/parse_mri_errors.rb

load_error_output = "0 tests, 0 assertions, 0 failures, 0 errors, 0 skips"

summary_regex = /\d+\stests,\s\d+\sassertions,\s\d+\sfailures,\s\d+\serrors,\s\d+\sskips/
split_errors = contents.split(load_error_output)
if split_errors.size > 1

puts "split_errors #{split_errors.size}"
err_files = split_errors.collect { |e| e.scan(/filesf \[\"(.*)\"\]/).last[0] }
patt = err_files.collect { |err| err.split("/mri/")[1] }

all_tests = contents.scan(/filesf \[\"(.*)\"\]/)
all_tests_patt = all_tests.collect { |err| err[0].split("/mri/")[1] }

non_excluded = all_tests_patt - patt

puts "# Test index"

i_hash = Hash[non_excluded.collect { |v| [v, true] }]
e_hash = Hash[patt.collect { |v| [v, false] }]

all_hash = i_hash.merge(e_hash)
all_hash = Hash[all_hash.sort_by{|k,v| k}]
all_hash.each do |k,v|
if v
puts k
else
puts "# #{k}"
end
end

end

t = /(\w+(::))?(.*)#(.*).*=.*=\s([.FE])/

require 'fileutils'
test_results = contents.scan(t)
test_results.each do |r|
if r[0]
unless r[4] == "."
dirname = "excludes_truffle/#{r[0].chop.chop}"
#puts "dirname #{dirname}"
Dir.mkdir(dirname) unless Dir.exist?(dirname)
if r[2].include?("::")
name_split = r[2].split('::')
nested_dirname = "#{dirname}/#{name_split[0]}"
Dir.mkdir(nested_dirname) unless Dir.exist?(nested_dirname)
File.open("#{nested_dirname}/#{name_split[1]}.rb", 'a') {|f| f.write("exclude :#{r[3].strip}, \"needs investigation\"\n") }
else
File.open("#{dirname}/#{r[2]}.rb", 'a') {|f| f.write("exclude :\"#{r[3].strip}\", \"needs investigation\"\n") }
end
end
else
unless r[4] == "."
File.open("excludes_truffle/#{r[2]}.rb", 'a') {|f| f.write("exclude :\"#{r[3].strip}\", \"needs investigation\"\n") }
end
end
end

0 comments on commit 0d84c97

Please sign in to comment.