brew-test-bot: generate email subject file.

This commit is contained in:
Mike McQuaid 2013-06-22 10:54:14 +01:00
parent 79f9da3c22
commit 33d58cdfa8

View File

@ -7,6 +7,7 @@
# --cleanup: Clean the Homebrew directory. Very dangerous. Use with care.
# --skip-setup: Don't check the local system is setup correctly.
# --junit: Generate a JUnit XML test results file.
# --email: Generate an email subject file.
require 'formula'
require 'utils'
@ -377,4 +378,24 @@ if ARGV.include? "--junit"
end
end
if ARGV.include? "--email"
failed_steps = []
tests.each do |test|
test.steps.each do |step|
next unless step.failed?
failed_steps << step.command.gsub(/(brew|--verbose) /, '')
end
end
if failed_steps.empty?
email_subject = 'brew test-bot: PASSED'
else
email_subject = "brew test-bot: FAILED: #{failed_steps.join ', '}"
end
File.open "brew test-bot.email.txt", 'w' do |file|
file.write email_subject
end
end
exit any_errors ? 0 : 1