Last active
December 13, 2015 19:58
-
-
Save brianjriddle/4966605 to your computer and use it in GitHub Desktop.
filter to get sane output from ocunit & kiwi tests when building xcode apps from the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
$stdout.sync = true | |
@failed_tests = [] | |
@success = true | |
@executed = "" | |
def green(s) | |
"\e[1;32m#{s}\e[0m" | |
end | |
def red(s) | |
"\e[1;31m#{s}\e[0m" | |
end | |
def orange(s) | |
"\e[1;33m#{s}\e[0m" | |
end | |
def filter(line) | |
output = "" | |
case line | |
when /Test Case '-.*' passed (.*)\./ | |
#output = "\e[1;32m.\e[0m" | |
output = green "." | |
when /\[FAILED\]/ | |
output = red "F" | |
@failed_tests << line | |
@success = false | |
when /^Executed / | |
@executed = line.chomp | |
end | |
output | |
end | |
ARGF.each do |line| | |
print filter line | |
end | |
puts | |
@failed_tests.each do |line| | |
puts line | |
end | |
puts orange @executed | |
if @success | |
puts green "** BUILD SUCCEEDED **" | |
else | |
puts red "** BUILD FAILED **" | |
exit 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment