diff --git a/tests/test.d/test.rb b/tests/test.d/test.rb index bc165e051..9620cbfe2 100644 --- a/tests/test.d/test.rb +++ b/tests/test.d/test.rb @@ -10,19 +10,6 @@ class Test @tmp_num_mutex = Mutex.new @commands = Array.new @debug_commands = Array.new - - # install md5 handler - if $is_macos - @md5 = lambda do |name| - @debug_commands << "/sbin/md5 #{name}" - `/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "") - end - else - @md5 = lambda do |name| - @debug_commands << "md5sum #{name}" - `md5sum #{name}`.chomp.gsub(/\s+.*/, "") - end - end end def description @@ -90,7 +77,7 @@ class Test end def hash_file(name) - @md5.call name + md5 name end def hash_tmp(erase = true) diff --git a/tests/test.d/util.rb b/tests/test.d/util.rb index aa90da562..3e9b7caa9 100644 --- a/tests/test.d/util.rb +++ b/tests/test.d/util.rb @@ -41,14 +41,10 @@ class String end end -# install md5 handler -if $is_macos - def md5 name - `/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "") - end -else - def md5 name - `md5sum #{name}`.chomp.gsub(/\s+.*/, "") +def md5 name + case + when $is_macos then `/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "") + else `md5sum #{name}`.chomp.gsub(/\s+.*/, "") end end