facebookarchive / xctool

An extension for Apple's xcodebuild that makes it easier to test iOS and macOS apps.
Apache License 2.0
6.91k stars 738 forks source link

xctool Crash Xcode6 beta 4. [SimDeviceType supportedDeviceTypes] #394

Closed finalquest closed 10 years ago

finalquest commented 10 years ago

Hi. Im running this line over my project.

xctool -project Notifications4Everyone.xcodeproj/ -scheme Notifications4Everyone -sdk iphonesimulator8.0 build test -showTasks

but I'm facing some issues in the testing phase. Im getting this particular error..

2014-07-22 15:30:49.929 xctool[26632:2607] *\ Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SimDeviceType supportedDeviceTypes]: unrecognized selector sent to class 0x107d0a168'

* First throw call stack: ( 0 CoreFoundation 0x00007fff8fea125c exceptionPreprocess + 172 1 libobjc.A.dylib 0x00007fff91a2ee75 objc_exception_throw + 43 2 CoreFoundation 0x00007fff8fea402d +[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x00007fff8fdff044 forwarding** + 452 4 CoreFoundation 0x00007fff8fdfedf8 _CF_forwarding_prep_0 + 120 5 xctool 0x0000000107cda2b4 -[SimulatorInfoXcode6 simulatedDeviceInfoName] + 302 6 xctool 0x0000000107cda52a -[SimulatorInfoXcode6 maxSdkVersionForSimulatedDevice] + 51 7 xctool 0x0000000107cda6ca -[SimulatorInfoXcode6 systemRootForSimulatedSdk] + 40 8 xctool 0x0000000107cda7b0 -[SimulatorInfoXcode6 simulatedRuntime] + 25 9 xctool 0x0000000107cda7fb -[SimulatorInfoXcode6 simulatedDevice] + 54 10 xctool 0x0000000107ce08b9 +[SimulatorWrapperXcode6 installTestHostBundleID:fromBundlePath:simulatorInfo:reporters:error:] + 72 11 xctool 0x0000000107cd0780 +[SimulatorWrapper installTestHostBundleID:fromBundlePath:simulatorInfo:reporters:error:] + 112 12 xctool 0x0000000107cc435c 75-[OCUnitIOSAppTestRunner runTestsAndFeedOutputTo:startupError:otherErrors:]_block_invoke66 + 233 13 xctool 0x0000000107cc3d83 -[OCUnitIOSAppTestRunner runTestsAndFeedOutputTo:startupError:otherErrors:] + 755 14 xctool 0x0000000107cc4f67 -[OCUnitTestRunner runTests] + 241 15 xctool 0x0000000107cce550 __158-[RunTestsAction blockForTestable:focusedTestCases:allTestCases:testableExecutionInfo:testableTarget:isApplicationTest:arguments:environment:testRunnerClass:]_block_invoke + 496

I've tried some params to specify the simulator to use, but there was no luck. Has anybody face this similar issue?

Regards

ExtremeMan commented 10 years ago

Thanks for reporting the issue. Could you post xcodebuild -version and xcode-select -p outputs? Also try cleaning xctool builds.

finalquest commented 10 years ago

hi.

This are the results.

xcode-select /Applications/Xcode6-Beta4.app/Contents/Developer

xcodebuild -version Xcode 6.0 Build version 6A254o

I've tried with a clean xctool with no luck.

Thanks. Regards

finalquest commented 10 years ago

Hi. I've cloned again the whole repo, and after a clean build everything works fine. Im closing this issues. Sorry for the trouble. Regards

ExtremeMan commented 10 years ago

Thanks for letting us know!

mgorbach commented 10 years ago

@ExtremeMan I'm also seeing this on our TeamCity-based continuous integration server, executing xctool to run integration tests on an iOS-8 only project. I've installed xctool HEAD from homebrew to pick up the new iOS 8 work you have done, and I am now getting the same error while running tests:

[14:25:26][Step 1/1]     [Info] Uninstalling 'com.Project.Project-iPad' to get a fresh install ...
[14:25:26][Step 1/1] 2014-07-25 14:25:26.639 xctool[8761:2607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SimDeviceType supportedDeviceTypes]: unrecognized selector sent to class 0x101cf5168'
[14:25:26][Step 1/1] *** First throw call stack:
[14:25:26][Step 1/1] (
[14:25:26][Step 1/1]    0   CoreFoundation                      0x00007fff93be725c __exceptionPreprocess + 172
[14:25:26][Step 1/1]    1   libobjc.A.dylib                     0x00007fff90e6de75 objc_exception_throw + 43
[14:25:26][Step 1/1]    2   CoreFoundation                      0x00007fff93bea02d +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
[14:25:26][Step 1/1]    3   CoreFoundation                      0x00007fff93b45044 ___forwarding___ + 452
[14:25:26][Step 1/1]    4   CoreFoundation                      0x00007fff93b44df8 _CF_forwarding_prep_0 + 120
[14:25:26][Step 1/1]    5   xctool                              0x0000000101cc5044 -[SimulatorInfoXcode6 simulatedDeviceInfoName] + 302
[14:25:26][Step 1/1]    6   xctool                              0x0000000101cc52ba -[SimulatorInfoXcode6 maxSdkVersionForSimulatedDevice] + 51
[14:25:26][Step 1/1]    7   xctool                              0x0000000101cc545a -[SimulatorInfoXcode6 systemRootForSimulatedSdk] + 40
[14:25:26][Step 1/1]    8   xctool                              0x0000000101cc5540 -[SimulatorInfoXcode6 simulatedRuntime] + 25
[14:25:26][Step 1/1]    9   xctool                              0x0000000101cc558b -[SimulatorInfoXcode6 simulatedDevice] + 54
[14:25:26][Step 1/1]    10  xctool                              0x0000000101ccb4de +[SimulatorWrapperXcode6 uninstallTestHostBundleID:simulatorInfo:reporters:error:] + 58
[14:25:26][Step 1/1]    11  xctool                              0x0000000101cbb3e1 +[SimulatorWrapper uninstallTestHostBundleID:simulatorInfo:reporters:error:] + 101
[14:25:26][Step 1/1]    12  xctool                              0x0000000101caf014 __75-[OCUnitIOSAppTestRunner runTestsAndFeedOutputTo:startupError:otherErrors:]_block_invoke66 + 145
[14:25:26][Step 1/1]    13  xctool                              0x0000000101caea93 -[OCUnitIOSAppTestRunner runTestsAndFeedOutputTo:startupError:otherErrors:] + 755
[14:25:26][Step 1/1]    14  xctool                              0x0000000101cafc77 -[OCUnitTestRunner runTests] + 241
[14:25:26][Step 1/1]    15  xctool                              0x0000000101cb9260 __158-[RunTestsAction blockForTestable:focusedTestCases:allTestCases:testableExecutionInfo:testableTarget:isApplicationTest:arguments:environment:testRunnerClass:]_block_invoke + 496
[14:25:26][Step 1/1]    16  xctool                              0x0000000101cba4d5 __56-[RunTestsAction runTestables:options:xcodeSubjectInfo:]_block_invoke330 + 210
[14:25:26][Step 1/1]    17  xctool                              0x0000000101cba0e0 -[RunTestsAction runTestables:options:xcodeSubjectInfo:] + 3359
[14:25:26][Step 1/1]    18  xctool                              0x0000000101cb8a4f -[RunTestsAction performActionWithOptions:xcodeSubjectInfo:] + 851
[14:25:26][Step 1/1]    19  xctool                              0x0000000101cc4d29 -[TestAction performActionWithOptions:xcodeSubjectInfo:] + 77
[14:25:26][Step 1/1]    20  xctool                              0x0000000101caba70 -[XCTool run] + 2047
[14:25:26][Step 1/1]    21  xctool                              0x0000000101caa9b0 main + 542
[14:25:26][Step 1/1]    22  xctool                              0x0000000101ca88b4 start + 52
[14:25:26][Step 1/1] )
[14:25:26][Step 1/1] libc++abi.dylib: terminating with uncaught exception of type NSException
[14:25:27][Step 1/1] /Users/teamcity/teamcity_agent_home/temp/agentTmp/custom_script80709418011730666: line 33:  8761 Abort trap: 6           xctool ${PROJ_FLAG} "${PROJ_PATH}" -scheme "Project iPad" -sdk iphonesimulator OBJROOT="/Users/teamcity/teamcity_agent_home/temp/buildTmp/build/" SYMROOT="/Users/teamcity/teamcity_agent_home/temp/buildTmp/build/" SHARED_PRECOMPS_DIR="${TEMP_PRECOMP_DIR_PATH}" -reporter junit:./junit.xml -reporter pretty clean test -freshInstall -freshSimulator
[14:25:27][Step 1/1] Process exited with code 134
[14:25:27][Step 1/1] Step Run tests (Command Line) failed

Anything I can do to help debug or work around this?

finalquest commented 10 years ago

I made a fresh clone of the repo, and set xcode-select -s to beta4 when compiled the xctool. That fix it for me

mgorbach commented 10 years ago

FYI, the script we're using to run xctool on TeamCity is as follows

# Super simple script to run iOS unit tests with xctool
PROJ_PATH="%company.xctests.projectPath%"
PROJ_FILE=$(basename "%company.xctests.projectPath%")
PROJ_EXTENSION="${PROJ_FILE##*.}"

PROJ_FLAG=""
if [ "$PROJ_EXTENSION" == "xcworkspace" ]; then
   echo "Found a workspace. Passing -workspace flag to xctool ..."
   PROJ_FLAG="-workspace"
else
   echo "Found a project. Passing -project flag to xctool ..."
   PROJ_FLAG="-project"
fi

echo "PROJ_FLAG is: \"${PROJ_FLAG}\" ..."

# We need a custom directory for precompiled headers, since xctool doesn't clean properly
TEMP_PRECOMP_DIR_PATH="%system.teamcity.build.tempDir%/precompiled_headers/"
rm -rf ${TEMP_PRECOMP_DIR_PATH}
mkdir -p ${TEMP_PRECOMP_DIR_PATH}

xctool \
   ${PROJ_FLAG} "${PROJ_PATH}" \
   -scheme "%company.xctests.schemeName%" \
   -sdk iphonesimulator \
   OBJROOT="%system.teamcity.build.tempDir%/build/" \
   SYMROOT="%system.teamcity.build.tempDir%/build/" \
   SHARED_PRECOMPS_DIR="${TEMP_PRECOMP_DIR_PATH}" \
   -reporter junit:./junit.xml \
   -reporter pretty \
   clean test \
   -freshInstall -freshSimulator
mgorbach commented 10 years ago

Ah, thanks @finalquest. Looks like you really do need to compile xctool itself with the latest beta, not just your code. Otherwise, no workie.