mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-23 19:31:44 +00:00
tests: don't hardcode path to temporary directory
This commit is contained in:
parent
0a96f4a19b
commit
15962e1b10
@ -90,5 +90,8 @@ EOHELP
|
||||
exit controller.num_failed > 0 ? 1 : 0
|
||||
end
|
||||
|
||||
setup
|
||||
main
|
||||
Dir.mktmpdir do |dir|
|
||||
$temp_dir = dir
|
||||
setup
|
||||
main
|
||||
end
|
||||
|
@ -67,7 +67,7 @@ class SimpleTest
|
||||
end
|
||||
|
||||
def tmp_name_prefix
|
||||
[ "/tmp/mkvtoolnix-auto-test-#{self.class.name}", $$.to_s, Thread.current[:number] ].join("-") + "-"
|
||||
[ "#{$temp_dir}/mkvtoolnix-auto-test-#{self.class.name}", $$.to_s, Thread.current[:number] ].join("-") + "-"
|
||||
end
|
||||
|
||||
def tmp_name
|
||||
@ -104,8 +104,8 @@ class SimpleTest
|
||||
def unlink_tmp_files
|
||||
return if ENV["KEEP_TMPFILES"] == "1"
|
||||
re = %r{^#{self.tmp_name_prefix}}
|
||||
Dir.entries("/tmp").each do |entry|
|
||||
file = "/tmp/#{entry}"
|
||||
Dir.entries($temp_dir).each do |entry|
|
||||
file = "#{$temp_dir}/#{entry}"
|
||||
File.unlink(file) if re.match(file) and File.exists?(file)
|
||||
end
|
||||
end
|
||||
|
@ -23,8 +23,8 @@ class Test
|
||||
def unlink_tmp_files
|
||||
return if (ENV["KEEP_TMPFILES"] == "1")
|
||||
re = /^#{self.tmp_name_prefix}/
|
||||
Dir.entries("/tmp").each do |entry|
|
||||
file = "/tmp/#{entry}"
|
||||
Dir.entries($temp_dir).each do |entry|
|
||||
file = "#{$temp_dir}/#{entry}"
|
||||
File.unlink(file) if re.match(file) and File.exists?(file)
|
||||
end
|
||||
end
|
||||
@ -59,7 +59,7 @@ class Test
|
||||
end
|
||||
|
||||
def tmp_name_prefix
|
||||
[ "/tmp/mkvtoolnix-auto-test", $$.to_s, Thread.current[:number] ].join("-") + "-"
|
||||
[ "#{$temp_dir}/mkvtoolnix-auto-test", $$.to_s, Thread.current[:number] ].join("-") + "-"
|
||||
end
|
||||
|
||||
def tmp_name
|
||||
|
Loading…
Reference in New Issue
Block a user