aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAndrew Janke2016-04-06 16:48:07 -0400
committerAndrew Janke2016-04-06 16:48:07 -0400
commit1f8b6cb57677d96228627baf28ce18a394df4c1d (patch)
tree239a307b776bc8a262a89c3c256d7133a3126047 /Library
parentbbb1fcd17c0979c5d7d90097108b39526fa94acb (diff)
downloadbrew-1f8b6cb57677d96228627baf28ce18a394df4c1d.tar.bz2
test-bot: add safety margin to output truncation size
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/test-bot.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb
index 1cc61ce11..e3642a499 100644
--- a/Library/Homebrew/cmd/test-bot.rb
+++ b/Library/Homebrew/cmd/test-bot.rb
@@ -37,6 +37,8 @@ require "tap"
module Homebrew
BYTES_IN_1_MEGABYTE = 1024*1024
+ MAX_STEP_OUTPUT_SIZE = BYTES_IN_1_MEGABYTE - (200*1024) # margin of safety
+
HOMEBREW_TAP_REGEX = %r{^([\w-]+)/homebrew-([\w-]+)$}
def ruby_has_encoding?
@@ -997,14 +999,14 @@ module Homebrew
output = output.delete("\000\a\b\e\f\x2\x1f")
end
- # Truncate to 1MB
- if output.bytesize > BYTES_IN_1_MEGABYTE
+ # Truncate to 1MB to avoid hitting CI limits
+ if output.bytesize > MAX_STEP_OUTPUT_SIZE
if ruby_has_encoding?
binary_output = output.force_encoding("BINARY")
- output = binary_output.slice(-BYTES_IN_1_MEGABYTE, BYTES_IN_1_MEGABYTE)
+ output = binary_output.slice(-MAX_STEP_OUTPUT_SIZE, MAX_STEP_OUTPUT_SIZE)
fix_encoding!(output)
else
- output = output.slice(-BYTES_IN_1_MEGABYTE, BYTES_IN_1_MEGABYTE)
+ output = output.slice(-MAX_STEP_OUTPUT_SIZE, MAX_STEP_OUTPUT_SIZE)
end
output = "truncated output to 1MB:\n" + output
end