From 76bbae2591c6ebda917ca612100df040b0c5f114 Mon Sep 17 00:00:00 2001 From: Akira Hayakawa Date: Fri, 30 May 2014 21:36:15 +0900 Subject: [PATCH 1/2] Add config item: test_scale To test the testcases using a small test set is a good idea. New config item called test_scale can tell the test scale to dmtest. new item (in config file) :test_scale default: :normal new command option: --test-scale Signed-off-by: Akira Hayakawa --- bin/dmtest | 18 ++++++++++++++++-- lib/dmtest/command_line.rb | 3 ++- lib/dmtest/config.rb | 6 ++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/bin/dmtest b/bin/dmtest index 629823e..ca636e1 100755 --- a/bin/dmtest +++ b/bin/dmtest @@ -316,8 +316,14 @@ class Dispatcher end end - def run(opts, args) + def setup_config(opts) setup_profile(opts.fetch(:profile, nil)) + setup_test_scale(opts.fetch(:test_scale, nil)) + end + + def run(opts, args) + setup_config(opts) + suite = select_tests(opts) runner = Test::Unit::UI::ThinTestRunner.new(suite, log_dir, Test::Unit::UI::VERBOSE) runner.start @@ -326,7 +332,8 @@ class Dispatcher end def list(opts, args) - setup_profile(opts.fetch(:profile, nil)) + setup_config(opts) + suite = select_tests(opts) print_suite('', suite, opts.member?(:tags)) end @@ -390,6 +397,12 @@ EOF $profile = cfg.profiles[sym] end + def setup_test_scale(sym = nil) + cfg = get_config + sym ||= cfg.default_test_scale + $test_scale = sym + end + def get_config txt = File.read(config_file) c = DMTest::Config.new do @@ -521,6 +534,7 @@ EOF # end # # default_profile :ssd +# default_test_scale :normal EOF end end diff --git a/lib/dmtest/command_line.rb b/lib/dmtest/command_line.rb index dfb3128..ade7de6 100644 --- a/lib/dmtest/command_line.rb +++ b/lib/dmtest/command_line.rb @@ -36,6 +36,7 @@ multivalue_switch :name, :filter, '-n', '--name' multivalue_switch :testcase, :filter, '-t' value_switch :profile, :symbol, '--profile' + value_switch :test_scale, :symbol, '--test-scale' value_switch :suite, :string, '--suite' value_switch :port, :int, '--port' @@ -43,7 +44,7 @@ end command :run do - switches :name, :profile, :suite, :testcase + switches :name, :profile, :test_scale, :suite, :testcase end command :list do diff --git a/lib/dmtest/config.rb b/lib/dmtest/config.rb index 8c059e0..b191af7 100644 --- a/lib/dmtest/config.rb +++ b/lib/dmtest/config.rb @@ -26,6 +26,7 @@ class Config def initialize(&block) @profiles = {} + @default_test_scale = :normal self.instance_eval(&block) if block end @@ -43,5 +44,10 @@ def default_profile(sym = nil) @default_profile = sym unless sym.nil? @default_profile end + + def default_test_scale(sym = nil) + @default_test_scale = sym unless sym.nil? + @default_test_scale + end end end From e50afd2b86a67f706be3c53d6a5e0a92f3ba82fe Mon Sep 17 00:00:00 2001 From: Akira Hayakawa Date: Fri, 30 May 2014 22:23:40 +0900 Subject: [PATCH 2/2] [writeboost] Remove DEBUGMODE and use $test_scale instead Signed-off-by: Akira Hayakawa --- lib/dmtest/tests/writeboost/tests.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/dmtest/tests/writeboost/tests.rb b/lib/dmtest/tests/writeboost/tests.rb index 4c1415b..b5abf47 100644 --- a/lib/dmtest/tests/writeboost/tests.rb +++ b/lib/dmtest/tests/writeboost/tests.rb @@ -29,10 +29,13 @@ module WriteboostTests attr_accessor :stack_maker - DEBUGMODE = false RUBY = 'ruby-2.1.1.tar.gz' RUBY_LOCATION = "http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz" + def debug_scale? + $test_scale == :debug + end + def grab_ruby unless File.exist?(RUBY) STDERR.puts "grabbing ruby archive from web" @@ -186,7 +189,7 @@ def run_dbench(s, option) end end - @param[0] = DEBUGMODE ? 1 : 300 + @param[0] = debug_scale? ? 1 : 300 opts = { :backing_sz => gig(2), @@ -207,7 +210,7 @@ def run_dbench(s, option) end def test_do_stress - @param[0] = DEBUGMODE ? 1 : 60 + @param[0] = debug_scale? ? 1 : 60 opts = { :cache_sz => meg(128), @@ -232,7 +235,7 @@ def test_do_stress # This actually deteriorates direct reads from the backing device. # This test is to see how Writeboost deteriorates the block reads compared to backing device only. def test_fio_read_overhead - @param[0] = DEBUGMODE ? 1 : 128 + @param[0] = debug_scale? ? 1 : 128 def run_fio(dev, iosize) ProcessControl.run("fio --name=test --filename=#{dev.path} --rw=randread --ioengine=libaio --direct=1 --size=#{@param[0]}m --ba=#{iosize}k --bs=#{iosize}k --iodepth=32") @@ -280,7 +283,7 @@ def test_git_extract_cache_quick # - How the effect changes according to the nr_max_batched_migration tunable? def test_writeback_sorting_effect - @param[0] = DEBUGMODE ? 1 : 128 + @param[0] = debug_scale? ? 1 : 128 def run_wb(s, batch_size) s.cleanup_cache @@ -317,7 +320,7 @@ def run_wb(s, batch_size) # 4KB randwrite performance def test_fio_randwrite_perf - @param[0] = DEBUGMODE ? 1 : 500 + @param[0] = debug_scale? ? 1 : 500 s = @stack_maker.new(@dm, @data_dev, @metadata_dev, :cache_sz => meg(@param[0] + 100)) s.activate_support_devs do s.cleanup_cache @@ -332,7 +335,7 @@ def test_fio_randwrite_perf end end def test_fio_cache_seqwrite # Baseline - @param[0] = DEBUGMODE ? 1 : 500 + @param[0] = debug_scale? ? 1 : 500 s = @stack_maker.new(@dm, @data_dev, @metadata_dev, :cache_sz => meg(@param[0] + 100)) s.activate_support_devs do system "fio --name=test --filename=#{s.cache_dev.path} --rw=write --ioengine=libaio --direct=1 --size=#{@param[0]}m --bs=256k --iodepth=32"