Created
February 17, 2012 01:04
-
-
Save markschabacker/1849427 to your computer and use it in GitHub Desktop.
Xcode 4.3 and xcodebuild Unit Tests
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
map ,xt :call RunBuildCommand("export RUN_SIMULATOR_TESTS=YES;xcodebuild -sdk iphonesimulator -configuration Debug -target testprojTests")<CR> | |
function! RunBuildCommand(cmd) | |
let l:BuildLog = "build/vim.log" | |
if bufname("%") != "" | |
silent write | |
endif | |
echo "Building... " | |
let l:StartTime = reltime() | |
exec "silent !" . a:cmd . " >" . l:BuildLog . " 2>&1" | |
" xcodebuild does NOT set exit code properly, so check the build log | |
exec "silent !grep -q '^\*\* BUILD FAILED' " . l:BuildLog | |
redraw! | |
if !v:shell_error | |
set errorformat= | |
\%f:%l:%c:{%*[^}]}:\ error:\ %m, | |
\%f:%l:%c:{%*[^}]}:\ fatal\ error:\ %m, | |
\%f:%l:%c:{%*[^}]}:\ warning:\ %m, | |
\%f:%l:%c:\ error:\ %m, | |
\%f:%l:%c:\ fatal\ error:\ %m, | |
\%f:%l:%c:\ warning:\ %m, | |
\%f:%l:\ Error:\ %m, | |
\%f:%l:\ error:\ %m, | |
\%f:%l:\ fatal\ error:\ %m, | |
\%f:%l:\ warning:\ %m | |
execute "cfile! " . l:BuildLog | |
else | |
echo "Building... OK - " . reltimestr(reltime(l:StartTime)) . " seconds" | |
endif | |
exec "silent!export RUN_SIMULATOR_TESTS=NO" | |
endfunction |
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
# /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/RunPlatformUnitTests | |
# around line 93 | |
if [ "${TEST_HOST}" != "" ]; then | |
if [ "${RUN_SIMULATOR_TESTS}" = "YES" ]; then | |
export OTHER_TEST_FLAGS="-RegisterForSystemEvents" | |
RunTestsForApplication "${TEST_HOST}" "${TEST_BUNDLE_PATH}" | |
else | |
Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)." | |
fi | |
else | |
# If no TEST_HOST is specified, assume we're running the test bundle. | |
RunTestsForBundle "${TEST_BUNDLE_PATH}" | |
fi |
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
if [ "${RUN_SIMULATOR_TESTS}" = "YES" ]; then | |
echo "overriding TEST_AFTER_BUILD since RUN_SIMULATOR_TESTS is set" | |
export TEST_AFTER_BUILD=YES | |
fi | |
# Run the unit tests in this test bundle. | |
"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment