|
# |
|
# -*- coding: utf-8 -*- |
|
# |
|
|
|
require 'rubygems' |
|
require 'FileUtils' |
|
|
|
def execute cmd |
|
fork do |
|
exec cmd |
|
end |
|
Process.wait |
|
end |
|
|
|
path = File.expand_path ARGV.shift |
|
tmp = path + "/tmp" |
|
ghunit = tmp + "/gh-unit" |
|
|
|
unless Dir.exist? path |
|
puts "error : Not exist directory ( %s )" % path |
|
exit |
|
end |
|
|
|
FileUtils.mkdir tmp |
|
FileUtils.mkdir path + "/Frameworks" |
|
execute "git clone https://github.com/gabriel/gh-unit.git " + ghunit |
|
|
|
FileUtils.cd ghunit + "/Project" |
|
execute "make" |
|
|
|
FileUtils.cd path |
|
FileUtils.cp_r(ghunit+"/Project/build/Debug/GHUnit.framework", path+"/Frameworks") |
|
|
|
FileUtils.cp(ghunit+"/Examples/MyTestable-MacOSX/GHUnitTestMain.m", path+"/GHUnitTestMain.m") |
|
FileUtils.cp(ghunit+"/Examples/MyTestable-MacOSX/RunTests.sh", path+"/RunTests.sh") |
|
FileUtils.cp(ghunit+"/Examples/MyTestable-MacOSX/Makefile", path+"/Makefile") |
|
|
|
File.open("patchfile.diff", "w") do |f| |
|
f.write DATA.read |
|
end |
|
execute "/usr/bin/patch -f -p0 < patchfile.diff" |
|
FileUtils.rm "patchfile.diff" |
|
|
|
|
|
__END__ |
|
--- Makefile.old 2011-05-28 03:39:10.000000000 +0900 |
|
+++ Makefile 2011-05-28 03:40:19.000000000 +0900 |
|
@@ -1,10 +1,9 @@ |
|
|
|
-default: |
|
- # Set default make action here |
|
+default: test |
|
|
|
# If you need to clean a specific target/configuration: $(COMMAND) -target $(TARGET) -configuration DebugOrRelease -sdk $(SDK) clean |
|
clean: |
|
-rm -rf build/* |
|
|
|
test: |
|
- GHUNIT_AUTORUN=1 GHUNIT_AUTOEXIT=1 xcodebuild -target Tests -configuration Debug -sdk macosx build |
|
+ WRITE_JUNIT_XML=1 GHUNIT_AUTORUN=1 GHUNIT_AUTOEXIT=1 xcodebuild -target Tests -configuration Debug -sdk macosx build |
|
|
|
|
|
--- RunTests.sh.old 2011-05-28 03:36:46.000000000 +0900 |
|
+++ RunTests.sh 2011-05-28 03:40:55.000000000 +0900 |
|
@@ -7,9 +7,9 @@ |
|
exit 0 |
|
fi |
|
|
|
-export DYLD_ROOT_PATH="$SDKROOT" |
|
-export DYLD_FRAMEWORK_PATH="$CONFIGURATION_BUILD_DIR" |
|
-export IPHONE_SIMULATOR_ROOT="$SDKROOT" |
|
+# export DYLD_ROOT_PATH="$SDKROOT" |
|
+# export DYLD_FRAMEWORK_PATH="$CONFIGURATION_BUILD_DIR" |
|
+# export IPHONE_SIMULATOR_ROOT="$SDKROOT" |
|
|
|
export MallocScribble=YES |
|
export MallocPreScribble=YES |
|
@@ -23,7 +23,7 @@ |
|
export NSHangOnUncaughtException=YES |
|
export NSAutoreleaseFreedObjectCheckEnabled=YES |
|
|
|
-export DYLD_FRAMEWORK_PATH="$CONFIGURATION_BUILD_DIR" |
|
+# export DYLD_FRAMEWORK_PATH="$CONFIGURATION_BUILD_DIR" |
|
|
|
TEST_TARGET_EXECUTABLE_PATH="$TARGET_BUILD_DIR/$EXECUTABLE_PATH" |
|
|
|
@@ -41,12 +41,14 @@ |
|
RUN_CMD="$TEST_TARGET_EXECUTABLE_PATH -RegisterForSystemEvents" |
|
|
|
echo "Running: $RUN_CMD" |
|
-$RUN_CMD |
|
+if "$TEST_TARGET_EXECUTABLE_PATH" "-RegisterForSystemEvents"; then |
|
+ : |
|
+fi |
|
RETVAL=$? |
|
|
|
-unset DYLD_ROOT_PATH |
|
-unset DYLD_FRAMEWORK_PATH |
|
-unset IPHONE_SIMULATOR_ROOT |
|
+# unset DYLD_ROOT_PATH |
|
+# unset DYLD_FRAMEWORK_PATH |
|
+# unset IPHONE_SIMULATOR_ROOT |
|
|
|
if [ -n "$WRITE_JUNIT_XML" ]; then |
|
MY_TMPDIR=`/usr/bin/getconf DARWIN_USER_TEMP_DIR` |
いえ、このgistを書いた当時リンク先のドキュメントを見つけられなかった(or 存在しなかった?)ので全く関係ないです。
WRITE_JUNIT_XML=YESは、Jenkinsの入力フォーマットに合わせるために、JUnitが吐くXML形式で出力してもらうため設定しています(おそらくリンク先も同じ理由です)。