Created
February 20, 2014 22:05
-
-
Save pjaspers/9124261 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
D=/Applications/Xcode.app/Contents/Developer/Library/Frameworks | |
OBJC=`awk '/^__OBJC__/ {print NR + 1; exit 0; }' $0` | |
RUBIES=`awk '/^__RUBY__/ {print NR + 1; exit 0; }' $0` | |
APP=`tail -n+$RUBIES $0` | |
# I moved the actual tests to another file | |
cat tests.x > /tmp/YOLOtests.m | |
clang -g -O0 -ObjC -F$D -I. -fmodules -fobjc-arc \ | |
-framework SenTestingKit \ | |
/tmp/YOLOtests.m *.m -o /tmp/YOLOtests || exit | |
install_name_tool -change \ | |
@rpath/SenTestingKit.framework/Versions/A/SenTestingKit \ | |
$D/SenTestingKit.framework/SenTestingKit \ | |
/tmp/YOLOtests || exit | |
ruby -e "$APP" "/tmp/YOLOtests" | |
exit | |
__RUBY__ | |
require "stringio" | |
require "open3" | |
def bold(s); s;end | |
def red(s); "\e[31m#{s}\e[0m";end | |
def green(s); "\e[32m#{s}\e[0m";end | |
def tab(n, s); s.gsub(/^/, " " * n); end | |
def log(message); $stdout.write message + "\n";end | |
document = nil | |
Open3.popen3(ARGV[0]) do |stdin, stdout, stderr, wait_thr| | |
while line = stderr.gets | |
case line | |
when /\[(\w+) (\w+)\]' started.$/ | |
if document != $1 | |
log bold("#{$1}") | |
end | |
document = $1 | |
test_method = $2 | |
when /\s(passed|failed)\s\((.*)\)/ | |
result = red("FAIL") | |
result = green("PASS") if $1 == "passed" | |
result = tab(2, result) | |
time = $2.gsub(/\sseconds/, "s") | |
log "#{result} #{test_method} (#{time})" | |
when /^(Executed(.?)+)$/ | |
if stderr.eof? | |
summary = $1 | |
if /(\d) failures?/.match(summary)[1] == "0" | |
summary.gsub!(/(\d failures?)/, green('\1')) | |
else | |
summary.gsub!(/(\d failures?)/, red('\1')) | |
end | |
log summary | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment