summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
Diffstat (limited to 'bootstraptest')
-rwxr-xr-xbootstraptest/runner.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index 1ba15fd207..047633c788 100755
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -17,13 +17,27 @@ end
if !Dir.respond_to?(:mktmpdir)
# copied from lib/tmpdir.rb
- def Dir.mktmpdir(prefix="d", tmpdir=nil)
+ def Dir.mktmpdir(prefix_suffix=nil, tmpdir=nil)
+ case prefix_suffix
+ when nil
+ prefix = "d"
+ suffix = ""
+ when String
+ prefix = prefix_suffix
+ suffix = ""
+ when Array
+ prefix = prefix_suffix[0]
+ suffix = prefix_suffix[1]
+ else
+ raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
+ end
tmpdir ||= Dir.tmpdir
t = Time.now.strftime("%Y%m%d")
n = nil
begin
path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
path << "-#{n}" if n
+ path << suffix
Dir.mkdir(path, 0700)
rescue Errno::EEXIST
n ||= 0
@@ -339,7 +353,7 @@ def in_temporary_working_directory(dir)
yield
}
else
- Dir.mktmpdir("bootstraptest.tmpwd") {|d|
+ Dir.mktmpdir(["bootstraptest", ".tmpwd"]) {|d|
Dir.chdir(d) {
yield
}