mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +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
|
exit controller.num_failed > 0 ? 1 : 0
|
||||||
end
|
end
|
||||||
|
|
||||||
setup
|
Dir.mktmpdir do |dir|
|
||||||
main
|
$temp_dir = dir
|
||||||
|
setup
|
||||||
|
main
|
||||||
|
end
|
||||||
|
@ -67,7 +67,7 @@ class SimpleTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def tmp_name_prefix
|
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
|
end
|
||||||
|
|
||||||
def tmp_name
|
def tmp_name
|
||||||
@ -104,8 +104,8 @@ class SimpleTest
|
|||||||
def unlink_tmp_files
|
def unlink_tmp_files
|
||||||
return if ENV["KEEP_TMPFILES"] == "1"
|
return if ENV["KEEP_TMPFILES"] == "1"
|
||||||
re = %r{^#{self.tmp_name_prefix}}
|
re = %r{^#{self.tmp_name_prefix}}
|
||||||
Dir.entries("/tmp").each do |entry|
|
Dir.entries($temp_dir).each do |entry|
|
||||||
file = "/tmp/#{entry}"
|
file = "#{$temp_dir}/#{entry}"
|
||||||
File.unlink(file) if re.match(file) and File.exists?(file)
|
File.unlink(file) if re.match(file) and File.exists?(file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -23,8 +23,8 @@ class Test
|
|||||||
def unlink_tmp_files
|
def unlink_tmp_files
|
||||||
return if (ENV["KEEP_TMPFILES"] == "1")
|
return if (ENV["KEEP_TMPFILES"] == "1")
|
||||||
re = /^#{self.tmp_name_prefix}/
|
re = /^#{self.tmp_name_prefix}/
|
||||||
Dir.entries("/tmp").each do |entry|
|
Dir.entries($temp_dir).each do |entry|
|
||||||
file = "/tmp/#{entry}"
|
file = "#{$temp_dir}/#{entry}"
|
||||||
File.unlink(file) if re.match(file) and File.exists?(file)
|
File.unlink(file) if re.match(file) and File.exists?(file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -59,7 +59,7 @@ class Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def tmp_name_prefix
|
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
|
end
|
||||||
|
|
||||||
def tmp_name
|
def tmp_name
|
||||||
|
Loading…
Reference in New Issue
Block a user