summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-01-29 14:19:57 -0800
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2020-01-30 12:26:19 +1300
commit83a0453dab56ceba969bb982249b42e33c76f59c (patch)
tree2c20fd13f4e777fdca7e17810bce81bcbd03c77b
parent8bca7743417808e952d2c78868c454d257679a07 (diff)
downloadrack-83a0453dab56ceba969bb982249b42e33c76f59c.tar.gz
Use temp path when profiling, may work better in CI
Also, fix the require in one of the stackprof tests.
-rw-r--r--test/spec_server.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/spec_server.rb b/test/spec_server.rb
index 443c5273..59b8afe9 100644
--- a/test/spec_server.rb
+++ b/test/spec_server.rb
@@ -250,28 +250,30 @@ describe Rack::Server do
require 'objspace'
rescue LoadError
else
+ t = Tempfile.new
begin
- SPEC_ARGV[0..-1] = ['-scgi', '--heap', 'test-heapfile', '-E', 'production', '-b', 'run ->(env){[200, {}, []]}']
+ SPEC_ARGV[0..-1] = ['-scgi', '--heap', t.path, '-E', 'production', '-b', 'run ->(env){[200, {}, []]}']
server = Rack::Server.new
def (server.server).run(*) end
def server.exit; throw :exit end
catch :exit do
server.start
end
- File.file?('test-heapfile').must_equal true
+ File.file?(t.path).must_equal true
ensure
- File.delete 'test-heapfile'
+ File.delete t.path
end
end
end
it "support --profile-mode option for stackprof profiling" do
begin
- require 'objspace'
+ require 'stackprof'
rescue LoadError
else
+ t = Tempfile.new
begin
- SPEC_ARGV[0..-1] = ['-scgi', '--profile', 'test-profile', '--profile-mode', 'cpu', '-E', 'production', '-b', 'run ->(env){[200, {}, []]}']
+ SPEC_ARGV[0..-1] = ['-scgi', '--profile', t.path, '--profile-mode', 'cpu', '-E', 'production', '-b', 'run ->(env){[200, {}, []]}']
server = Rack::Server.new
def (server.server).run(*) end
def server.puts(*) end
@@ -279,9 +281,9 @@ describe Rack::Server do
catch :exit do
server.start
end
- File.file?('test-profile').must_equal true
+ File.file?(t.path).must_equal true
ensure
- File.delete 'test-profile'
+ File.delete t.path
end
end
end