mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
tests: provide global vars distinguishing platforms
This commit is contained in:
parent
4ab5d81ce1
commit
f681458bfc
@ -21,7 +21,11 @@ rescue
|
|||||||
end
|
end
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
ENV[ /darwin/i.match(RUBY_PLATFORM) ? 'LANG' : 'LC_ALL' ] = 'en_US.UTF-8'
|
$is_windows = %r{win|mingw}i.match(RUBY_PLATFORM)
|
||||||
|
$is_macos = %r{darwin}i.match(RUBY_PLATFORM)
|
||||||
|
$is_linux = !$is_windows && !$is_macos
|
||||||
|
|
||||||
|
ENV[ $is_macos ? 'LANG' : 'LC_ALL' ] = 'en_US.UTF-8'
|
||||||
ENV['PATH'] = "../src:" + ENV['PATH']
|
ENV['PATH'] = "../src:" + ENV['PATH']
|
||||||
|
|
||||||
$config = read_build_config
|
$config = read_build_config
|
||||||
|
@ -19,7 +19,7 @@ class Controller
|
|||||||
|
|
||||||
def get_num_processors
|
def get_num_processors
|
||||||
np = case RUBY_PLATFORM
|
np = case RUBY_PLATFORM
|
||||||
when /darwin/ then `/usr/sbin/sysctl -n hw.availcpu`.to_i
|
when $is_macos then `/usr/sbin/sysctl -n hw.availcpu`.to_i
|
||||||
else `nproc`.to_i
|
else `nproc`.to_i
|
||||||
end
|
end
|
||||||
[ np, 0 ].max + 1
|
[ np, 0 ].max + 1
|
||||||
|
@ -12,8 +12,7 @@ class Test
|
|||||||
@debug_commands = Array.new
|
@debug_commands = Array.new
|
||||||
|
|
||||||
# install md5 handler
|
# install md5 handler
|
||||||
case RUBY_PLATFORM
|
if $is_macos
|
||||||
when /darwin/
|
|
||||||
@md5 = lambda do |name|
|
@md5 = lambda do |name|
|
||||||
@debug_commands << "/sbin/md5 #{name}"
|
@debug_commands << "/sbin/md5 #{name}"
|
||||||
`/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "")
|
`/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "")
|
||||||
|
@ -42,8 +42,7 @@ class String
|
|||||||
end
|
end
|
||||||
|
|
||||||
# install md5 handler
|
# install md5 handler
|
||||||
case RUBY_PLATFORM
|
if $is_macos
|
||||||
when /darwin/
|
|
||||||
def md5 name
|
def md5 name
|
||||||
`/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "")
|
`/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user