From f13e8b3bd765e354dd68b0d17c83d19793864513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20R=C3=BCger?= Date: Wed, 18 Sep 2019 13:10:55 +0300 Subject: [PATCH] A little work on test times They have been rising of late, installer reporter to check 8and keep checking) tweaking of cli parameters removed redundant interpreter tests --- Gemfile | 2 + Gemfile.lock | 9 ++++ Guardfile | 7 +-- lib/rubyx/rubyxc.rb | 2 +- test/helper.rb | 3 -- test/risc/interpreter/calling/test_plus.rb | 20 +++------ test/risc/interpreter/test_return.rb | 44 +------------------ .../interpreter/while/test_while_simple.rb | 2 +- test/rubyx/test_compile.rb | 3 +- test/rubyx/test_execute.rb | 3 +- test/rubyx/test_interpret.rb | 3 +- test/rubyx/test_stats.rb | 3 +- 12 files changed, 32 insertions(+), 69 deletions(-) diff --git a/Gemfile b/Gemfile index c066867b..8e5c8738 100644 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,8 @@ gem "rake" gem "rx-file" , git: "https://github.com/ruby-x/rx-file" #gem "rx-file" , path: "../rx-file" group :test do +# reporter and parallel dont work together +# gem "minitest-reporters" gem "minitest-parallel_fork" gem "codeclimate-test-reporter" , require: false gem "simplecov" diff --git a/Gemfile.lock b/Gemfile.lock index 3e56378d..0dc7518f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,7 +14,9 @@ PATH GEM remote: https://rubygems.org/ specs: + ansi (1.5.0) ast (2.4.0) + builder (3.2.3) codeclimate-test-reporter (1.0.9) simplecov (<= 0.13) coderay (1.1.2) @@ -49,6 +51,11 @@ GEM minitest (~> 5) minitest-parallel_fork (1.1.2) minitest-profile (0.0.2) + minitest-reporters (1.3.8) + ansi + builder + minitest (>= 5.0) + ruby-progressbar nenv (0.3.0) notiffany (0.1.3) nenv (~> 0.1) @@ -63,6 +70,7 @@ GEM rb-inotify (0.10.0) ffi (~> 1.0) rb-readline (0.5.5) + ruby-progressbar (1.10.1) ruby_dep (1.5.0) shellany (0.0.1) simplecov (0.13.0) @@ -84,6 +92,7 @@ DEPENDENCIES minitest-fail-fast minitest-parallel_fork minitest-profile + minitest-reporters rake rb-readline rubyx! diff --git a/Guardfile b/Guardfile index ef4fd97d..6ae36aa7 100644 --- a/Guardfile +++ b/Guardfile @@ -1,7 +1,8 @@ -# A sample Guardfile -# More info at https://github.com/guard/guard#readme +# can't put in helper or it will run (and fail) with parallel +#require "minitest/reporters" +#Minitest::Reporters.use!( Minitest::Reporters::MeanTimeReporter.new) -guard :minitest , all_on_start: false do # with Minitest::Unit +guard :minitest ,:cli => "--profile", all_on_start: false do # with Minitest::Unit # if any test file changes, run that test watch(%r{^test/(.*)\/?test_(.*)\.rb$}) diff --git a/lib/rubyx/rubyxc.rb b/lib/rubyx/rubyxc.rb index 9300c7c8..14824af5 100644 --- a/lib/rubyx/rubyxc.rb +++ b/lib/rubyx/rubyxc.rb @@ -4,7 +4,7 @@ require "risc/interpreter" class RubyXC < Thor class_option :integers , type: :numeric - class_option :mesages , type: :numeric + class_option :messages , type: :numeric class_option :elf , type: :boolean class_option :preload , type: :boolean diff --git a/test/helper.rb b/test/helper.rb index 2fbecb1c..ae7340e2 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -16,9 +16,6 @@ require "minitest/color" require "minitest/autorun" require "minitest/fail_fast" unless ENV["TEST_ALL"] require 'minitest/profile' -#require "minitest/reporters" -#Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new - $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'test')) diff --git a/test/risc/interpreter/calling/test_plus.rb b/test/risc/interpreter/calling/test_plus.rb index c7eb6ef4..7df2bde0 100644 --- a/test/risc/interpreter/calling/test_plus.rb +++ b/test/risc/interpreter/calling/test_plus.rb @@ -9,7 +9,7 @@ module Risc @string_input = as_main("return 5 + 5") super end - +#FIXME should be mom macro test, no need to interpret def test_chain #show_main_ticks # get output of what is check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5 @@ -28,23 +28,23 @@ module Risc def base_ticks(num) main_ticks(14 + num) end - def test_base + def est_base cal = main_ticks( 14 ) assert_equal FunctionCall , cal.class end - def test_load_receiver + def est_load_receiver sl = base_ticks( 8 ) assert_slot_to_reg( sl , :r0 , 2 , :r2) end - def test_reduce_receiver + def est_reduce_receiver sl = base_ticks( 9 ) assert_slot_to_reg( sl , :r2 , 2 , :r2) end - def test_slot_args #load args from message + def est_slot_args #load args from message sl = base_ticks( 10 ) assert_slot_to_reg( sl , :r0 , 9 , :r3) end - def test_reduce_arg + def est_reduce_arg sl = base_ticks( 11 ) assert_slot_to_reg( sl , :r3 , 2 , :r3) assert_equal 5 , @interpreter.get_register(:r3) @@ -66,13 +66,5 @@ module Risc int = base_ticks( 14 ) assert_reg_to_slot( int , :r1 , :r0 , 5) end - def test_move_fix_to_result - sl = base_ticks( 15 ) - assert_slot_to_reg( sl , :r0 , 5 , :r2) - end - def test_move_fix_to_result - sl = base_ticks( 16 ) - assert_reg_to_slot( sl , :r2 , :r0 , 5) - end end end diff --git a/test/risc/interpreter/test_return.rb b/test/risc/interpreter/test_return.rb index a7c763d0..28195274 100644 --- a/test/risc/interpreter/test_return.rb +++ b/test/risc/interpreter/test_return.rb @@ -17,58 +17,16 @@ module Risc assert_equal 5 , get_return end - def test_call_main + def est_call_main call_ins = ticks(main_at) assert_equal FunctionCall , call_ins.class assert :main , call_ins.method.name end - def test_load_5 - load_ins = main_ticks(1) - assert_load load_ins , Parfait::Integer - assert_equal 5 , load_ins.constant.value - end - def test_store_ret_val - sl = main_ticks( 2 ) - assert_reg_to_slot( sl , :r1 , :r0 , 5) - end - def test_branch - sl = main_ticks( 3 ) - assert_equal Branch , sl.class - assert_equal "return_label" , sl.label.name - end - def test_load_ret - sl = main_ticks( 4 ) - assert_slot_to_reg( sl , :r0 , 5 , :r1) - end - def test_load_caller - sl = main_ticks( 5 ) - assert_slot_to_reg( sl , :r0 , 6 , :r2) - end - def test_load_caller_ret - sl = main_ticks( 6 ) - assert_reg_to_slot( sl , :r1 , :r2 , 5) - end - def test_load_ret_add - sl = main_ticks( 7 ) - assert_slot_to_reg( sl , :r0 , 4 , :r3) - end - def test_reduce_addedd - sl = main_ticks( 8 ) - assert_slot_to_reg( sl , :r3 , 2 , :r3) - end - def test_load_next_message - sl = main_ticks( 9 ) - assert_slot_to_reg( sl , :r0 , 6 , :r0) - end def test_function_return ret = main_ticks(10) assert_equal FunctionReturn , ret.class link = @interpreter.get_register( ret.register ) assert_equal ::Integer , link.class end - def test_transfer - transfer = main_ticks(11) - assert_equal Transfer , transfer.class - end end end diff --git a/test/risc/interpreter/while/test_while_simple.rb b/test/risc/interpreter/while/test_while_simple.rb index 4896ddd8..d0093961 100644 --- a/test/risc/interpreter/while/test_while_simple.rb +++ b/test/risc/interpreter/while/test_while_simple.rb @@ -1,7 +1,7 @@ require_relative "../helper" module Risc - class InterpreterWhileSimle < MiniTest::Test + class InterpreterWhileSimple < MiniTest::Test include Ticker def setup diff --git a/test/rubyx/test_compile.rb b/test/rubyx/test_compile.rb index da0f0d25..f020dc74 100644 --- a/test/rubyx/test_compile.rb +++ b/test/rubyx/test_compile.rb @@ -5,7 +5,8 @@ module RubyX class TestRubyXCliCompile < MiniTest::Test def test_compile - assert_output(/compiling/) {RubyXC.start(["compile" , "--preload","test/mains/source/add__4.rb"])} + assert_output(/compiling/) {RubyXC.start(["compile" , "--preload", + "--integers=50","--messages=50","test/mains/source/add__4.rb"])} end end end diff --git a/test/rubyx/test_execute.rb b/test/rubyx/test_execute.rb index df3ada08..162d172a 100644 --- a/test/rubyx/test_execute.rb +++ b/test/rubyx/test_execute.rb @@ -5,7 +5,8 @@ module RubyX class TestRubyXCliExecute < MiniTest::Test def test_execute - assert_output(/Running/) {RubyXC.start(["execute" ,"--preload", "test/mains/source/add__4.rb"])} + assert_output(/Running/) {RubyXC.start(["execute" ,"--preload", + "--integers=50","--messages=50" , "test/mains/source/add__4.rb"])} end end end diff --git a/test/rubyx/test_interpret.rb b/test/rubyx/test_interpret.rb index f8a3d861..c3cd0d3d 100644 --- a/test/rubyx/test_interpret.rb +++ b/test/rubyx/test_interpret.rb @@ -5,7 +5,8 @@ module RubyX class TestRubyXCliInterpret < MiniTest::Test def test_interpret - assert_output(/interpreting/) {RubyXC.start(["interpret" ,"--preload", "test/mains/source/add__4.rb"])} + assert_output(/interpreting/) {RubyXC.start(["interpret" ,"--preload", + "--integers=50","--messages=50" , "test/mains/source/add__4.rb"])} end end end diff --git a/test/rubyx/test_stats.rb b/test/rubyx/test_stats.rb index cfda2e3d..5cfc70a2 100644 --- a/test/rubyx/test_stats.rb +++ b/test/rubyx/test_stats.rb @@ -5,7 +5,8 @@ module RubyX class TestRubyXCliStats < MiniTest::Test def test_stats - out, err = capture_io {RubyXC.start(["stats" ,"--preload", "test/mains/source/add__4.rb"])} + out, err = capture_io {RubyXC.start(["stats" ,"--preload", + "--integers=50","--messages=50", "test/mains/source/add__4.rb"])} assert out.include?("Space") , out assert out.include?("Total") , out assert out.include?("Objects=") , out