mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
tests: use centralize MD5 generation functions
This commit is contained in:
parent
b0bbcc7a87
commit
0a96f4a19b
@ -10,19 +10,6 @@ class Test
|
|||||||
@tmp_num_mutex = Mutex.new
|
@tmp_num_mutex = Mutex.new
|
||||||
@commands = Array.new
|
@commands = Array.new
|
||||||
@debug_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
|
end
|
||||||
|
|
||||||
def description
|
def description
|
||||||
@ -90,7 +77,7 @@ class Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def hash_file(name)
|
def hash_file(name)
|
||||||
@md5.call name
|
md5 name
|
||||||
end
|
end
|
||||||
|
|
||||||
def hash_tmp(erase = true)
|
def hash_tmp(erase = true)
|
||||||
|
@ -41,14 +41,10 @@ class String
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# install md5 handler
|
|
||||||
if $is_macos
|
|
||||||
def md5 name
|
def md5 name
|
||||||
`/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "")
|
case
|
||||||
end
|
when $is_macos then `/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "")
|
||||||
else
|
else `md5sum #{name}`.chomp.gsub(/\s+.*/, "")
|
||||||
def md5 name
|
|
||||||
`md5sum #{name}`.chomp.gsub(/\s+.*/, "")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user