mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* common.mk : rename yarv-test-[all/each] to compare-test[/-each].
purpose of "compare-test" rule is to compare ruby (trunk) and matzruby (branches/matzruby) binary in miniruby level. MATZRUBY parameter means an path to miniruby of matzruby binary. to do this comparison test, you should build matzruby branch. * yarvtest/yarvtest.rb : fix to use command line option as command names to be compared. * yarvtest/runner.rb : remove a debug output. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
31d815aacf
commit
3e5b3dac1f
4 changed files with 137 additions and 150 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
Thu Jan 4 20:01:29 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* common.mk : rename yarv-test-[all/each] to compare-test[/-each].
|
||||
purpose of "compare-test" rule is to compare ruby (trunk) and
|
||||
matzruby (branches/matzruby) binary in miniruby level. MATZRUBY
|
||||
parameter means an path to miniruby of matzruby binary. to do this
|
||||
comparison test, you should build matzruby branch.
|
||||
|
||||
* yarvtest/yarvtest.rb : fix to use command line option as
|
||||
command names to be compared.
|
||||
|
||||
* yarvtest/runner.rb : remove a debug output.
|
||||
|
||||
Thu Jan 4 19:12:27 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* common.mk : fix to use test.rb script in build directory.
|
||||
|
|
|
@ -523,6 +523,7 @@ blockinlining.$(OBJEXT): {$(VPATH)}yarv.h {$(VPATH)}yarvcore.h vm_opts.h
|
|||
|
||||
|
||||
BASERUBY = ruby
|
||||
MATZRUBY = ruby
|
||||
|
||||
INSNS2VMOPT = $(CPPFLAGS) --srcdir=$(srcdir)
|
||||
|
||||
|
@ -559,11 +560,11 @@ incs:
|
|||
docs:
|
||||
$(BASERUBY) -I$(srcdir) $(srcdir)/tool/makedocs.rb $(INSNS2VMOPT)
|
||||
|
||||
yarv-test-all: miniruby$(EXEEXT)
|
||||
$(BASERUBY) -I$(srcdir) $(srcdir)/yarvtest/runner.rb $(OPT) yarv=$(MINIRUBY) ruby=$(BASERUBY)
|
||||
compare-test: miniruby$(EXEEXT)
|
||||
$(BASERUBY) -I$(srcdir) $(srcdir)/yarvtest/runner.rb $(OPT) ruby=$(MINIRUBY) matzruby=$(MATZRUBY)
|
||||
|
||||
yarv-test-each: miniruby$(EXEEXT)
|
||||
$(BASERUBY) -I$(srcdir) $(srcdir)/yarvtest/test_$(ITEM).rb $(OPT) yarv=$(MINIRUBY) ruby=$(BASERUBY)
|
||||
compare-test-each: miniruby$(EXEEXT)
|
||||
$(BASERUBY) -I$(srcdir) $(srcdir)/yarvtest/test_$(ITEM).rb $(OPT) ruby=$(MINIRUBY) matzruby=$(MATZRUBY)
|
||||
|
||||
allload: miniruby$(EXEEXT)
|
||||
$(MINIRUBY) -I$(srcdir) $(srcdir)/tool/allload.rb `$(BASERUBY) -rrbconfig -e 'print Config::CONFIG["rubylibdir"]'`
|
||||
|
|
|
@ -3,7 +3,6 @@ require 'test/unit'
|
|||
if $0 == __FILE__
|
||||
# exit Test::Unit::AutoRunner.run(false, File.dirname($0))
|
||||
Dir.glob(File.dirname($0) + '/test_*'){|file|
|
||||
p file
|
||||
require file
|
||||
}
|
||||
end
|
||||
|
|
|
@ -1,53 +1,29 @@
|
|||
require 'test/unit'
|
||||
|
||||
if defined? YARV_PATCHED
|
||||
require 'yarvutil'
|
||||
|
||||
class YarvTestBase < Test::Unit::TestCase
|
||||
|
||||
def remove_const sym
|
||||
Object.module_eval{
|
||||
remove_const sym
|
||||
}
|
||||
end
|
||||
|
||||
def remove_method sym
|
||||
Object.module_eval{
|
||||
undef sym
|
||||
}
|
||||
end
|
||||
|
||||
def ae str
|
||||
# puts str
|
||||
# puts YARVUtil.parse(str, $0, 0).disasm
|
||||
|
||||
ruby = YARVUtil.eval_in_wrap(str)
|
||||
yield if block_given?
|
||||
|
||||
yarv = YARVUtil.eval(str)
|
||||
yield if block_given?
|
||||
|
||||
assert_equal(ruby, yarv)
|
||||
end
|
||||
|
||||
def test_
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
require 'rbconfig'
|
||||
require 'optparse'
|
||||
|
||||
if /mswin32/ !~ RUBY_PLATFORM
|
||||
$ruby = './miniruby'
|
||||
else
|
||||
$ruby = 'miniruby'
|
||||
end
|
||||
$matzruby = Config::CONFIG['ruby_install_name']
|
||||
|
||||
ARGV.each{|opt|
|
||||
if /\Aruby=(.+)/ =~ opt
|
||||
$ruby = $1
|
||||
elsif /\Amatzruby=(.+)/ =~ opt
|
||||
$matzruby = $1
|
||||
end
|
||||
}
|
||||
|
||||
puts "matzruby: #{`#{$matzruby} -v`}"
|
||||
puts "ruby : #{`#{$ruby} -v`}"
|
||||
|
||||
class YarvTestBase < Test::Unit::TestCase
|
||||
def initialize *args
|
||||
super
|
||||
|
||||
if /mswin32/ !~ RUBY_PLATFORM
|
||||
@yarv = './miniruby'
|
||||
else
|
||||
@yarv = 'miniruby'
|
||||
end
|
||||
@ruby = Config::CONFIG['ruby_install_name']
|
||||
end
|
||||
|
||||
def remove_const sym
|
||||
|
@ -112,19 +88,19 @@ class YarvTestBase < Test::Unit::TestCase
|
|||
})
|
||||
}
|
||||
|
||||
ruby = exec(@ruby, evalstr)
|
||||
yarv = exec(@yarv, evalstr)
|
||||
matzruby = exec($matzruby, evalstr)
|
||||
ruby = exec($ruby, evalstr)
|
||||
|
||||
if $DEBUG #|| true
|
||||
puts "yarv (#@yarv): #{yarv}"
|
||||
puts "ruby (#@ruby): #{ruby}"
|
||||
puts "matzruby (#$matzruby): #{matzruby}"
|
||||
puts "ruby (#$ruby): #{ruby}"
|
||||
end
|
||||
|
||||
assert_equal(ruby.gsub(/\r/, ''), yarv.gsub(/\r/, ''))
|
||||
assert_equal(ruby.gsub(/\r/, ''), ruby.gsub(/\r/, ''))
|
||||
|
||||
# store/load test
|
||||
if false # || true
|
||||
yarvasm = dump_and_exec(@yarv, str)
|
||||
yarvasm = dump_and_exec($ruby, str)
|
||||
assert_equal(ruby.gsub(/\r/, ''), yarvasm.gsub(/\r/, ''))
|
||||
end
|
||||
end
|
||||
|
@ -132,5 +108,3 @@ class YarvTestBase < Test::Unit::TestCase
|
|||
def test_
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue