From 80040c166e5f53bdbbaf57dbb5e1d282d715d434 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Mon, 23 Jan 2017 02:47:16 +0000 Subject: improve C0 coverage of insns.def from 65.9% to 96.1% While I was developing my private topic branch I found that the VM itself is not tested very much in `make test` tests. Of course `make test-all` covers vast majority of the VM but running that task is not an immediately possible thing when we are touching the VM. In order to boost development in a rapid cycle I decided to add some tests to the bootstraptest. Here it is. * test_insns.rb: new test that covers insns.def. * runner.rb (#assert_equal): pass extra options to the target so that we can test frozen_string_literal: true situation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bootstraptest/runner.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'bootstraptest/runner.rb') diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index 754c3f0f3b..110b00d658 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -267,17 +267,17 @@ def nacl? @ruby and File.basename(@ruby.split(/\s/).first)['sel_ldr'] end -def assert_check(testsrc, message = '', opt = '') +def assert_check(testsrc, message = '', opt = '', **argh) show_progress(message) { - result = get_result_string(testsrc, opt) + result = get_result_string(testsrc, opt, **argh) check_coredump yield(result) } end -def assert_equal(expected, testsrc, message = '') +def assert_equal(expected, testsrc, message = '', opt = '', **argh) newtest - assert_check(testsrc, message) {|result| + assert_check(testsrc, message, opt, **argh) {|result| if expected == result nil else @@ -419,18 +419,19 @@ def untabify(str) str.gsub(/^\t+/) {' ' * (8 * $&.size) } end -def make_srcfile(src) +def make_srcfile(src, frozen_string_literal: nil) filename = 'bootstraptest.tmp.rb' File.open(filename, 'w') {|f| + f.puts "#frozen_string_literal:true" if frozen_string_literal f.puts "GC.stress = true" if $stress f.puts "print(begin; #{src}; end)" } filename end -def get_result_string(src, opt = '') +def get_result_string(src, opt = '', **argh) if @ruby - filename = make_srcfile(src) + filename = make_srcfile(src, **argh) begin `#{@ruby} -W0 #{opt} #{filename}` ensure -- cgit v1.2.1