How to run cases on device from command line #13

Closed
chayang opened this Issue Jul 13, 2010 · 6 comments

Projects

None yet

7 participants

@chayang

I can run cases on device (ipad) from xcode GUI.
I can run cases on simulator from command line.
But failed to run on device (ipad) from command line. say Bad CPU type:
Would you help me to analyze the issue?

This is my execution using the example from your source code:
$ make test

GHUNIT_CLI=1 xcodebuild -target Tests -configuration Debug -sdk iphoneos3.2 build
Build settings from command line:
PLATFORM_NAME = iphoneos
SDKROOT = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk

=== BUILD NATIVE TARGET Tests OF PROJECT MyTestable WITH CONFIGURATION Debug ===
Check dependencies
warning: building with 'Targeted Device Family' set to iPhone only ('1') not supported with SDK 'Device - iPhone OS 3.2'.
[BWARN]warning: building with 'Targeted Device Family' set to iPhone only ('1') not supported with SDK 'Device - iPhone OS 3.2'.
GenerateDSYMFile build/Debug-iphoneos/Tests.app.dSYM build/Debug-iphoneos/Tests.app/Tests
cd "/Users/charles/Unit Test/MyTestable-IPhone-device"
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
/Developer/usr/bin/dsymutil "/Users/charles/Unit Test/MyTestable-IPhone-device/build/Debug-iphoneos/Tests.app/Tests" -o "/Users/charles/Unit Test/MyTestable-IPhone-device/build/Debug-iphoneos/Tests.app.dSYM"

PhaseScriptExecution "Run Script" build/MyTestable.build/Debug-iphoneos/Tests.build/Script-00C1A3190F52872F00FCCA14.sh
cd "/Users/charles/Unit Test/MyTestable-IPhone-device"
/bin/sh -c "\"/Users/charles/Unit Test/MyTestable-IPhone-device/build/MyTestable.build/Debug-iphoneos/Tests.build/Script-00C1A3190F52872F00FCCA14.sh\""

Libraries/libGHUnitIPhone3_0-0.4.18/RunTests.sh: line 23: /Users/charles/Unit Test/MyTestable-IPhone-device/build/Debug-iphoneos/Tests.app/Tests: Bad CPU type in executable
Command /bin/sh failed with exit code 126
Command /bin/sh failed with exit code 126
Touch build/Debug-iphoneos/Tests.app
cd "/Users/charles/Unit Test/MyTestable-IPhone-device"
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
/usr/bin/touch -c "/Users/charles/Unit Test/MyTestable-IPhone-device/build/Debug-iphoneos/Tests.app"

CodeSign build/Debug-iphoneos/Tests.app
cd "/Users/charles/Unit Test/MyTestable-IPhone-device"
setenv IGNORE_CODESIGN_ALLOCATE_RADAR_7181968 /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
/usr/bin/codesign -f -s "iPhone Developer: Xueliang Hua (GWY394QHN8)" "--resource-rules=/Users/charles/Unit Test/MyTestable-IPhone-device/build/Debug-iphoneos/Tests.app/ResourceRules.plist" --entitlements "/Users/charles/Unit Test/MyTestable-IPhone-device/build/MyTestable.build/Debug-iphoneos/Tests.build/Tests.xcent" "/Users/charles/Unit Test/MyTestable-IPhone-device/build/Debug-iphoneos/Tests.app"

/Users/charles/Unit Test/MyTestable-IPhone-device/build/Debug-iphoneos/Tests.app: invalid format for signature
Command /usr/bin/codesign failed with exit code 1
Command /usr/bin/codesign failed with exit code 1
** BUILD FAILED **

The following build commands failed:
Tests:
PhaseScriptExecution "Run Script" "/Users/charles/Unit Test/MyTestable-IPhone-device/build/MyTestable.build/Debug-iphoneos/Tests.build/Script-00C1A3190F52872F00FCCA14.sh"

@chayang

Anyone know that?
Thank you very much.

@raid5

+1 I'm getting "Bad CPU type in executable" also when trying to run tests on the command line for an ipad project.

@ghost

Same problem here. XCode must be doing something different than the script but I tried a bunch of different things and could not figure it out. I tried setting ARCHS="armv6 armv7" as one of the parameters to xcodebuild, thought that would fix it but it didn't.

@ankitthakur

+1, Still getting the same issue:

./RunTests.sh: line 37:...
Bad CPU type in executable
Command /bin/sh failed with exit code 126

@DenHeadless

Can this be reopened?
It seems that issue still remains. I'm also getting "Bad CPU type in executable" error. I tried replacing that line with

RUN_CMD="\"$TEST_TARGET_EXECUTABLE_PATH\" -RegisterForSystemEvents || continue"

But now tests don't seem to run at all.

I'm using cocoapods in my project, and Jenkins as a CI server. I'm running following command:

xcodebuild -scheme GHUnitTests -workspace <MyWorkspace>.xcworkspace -configuration Debug build GHUNIT_CLI=1 GHUNIT_AUTORUN=1 GHUNIT_AUTOEXIT=1 WRITE_JUNIT_XML=YES JUNIT_XML_DIR=test-reports
@takachan114

Same issue.

@x2on x2on closed this Aug 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment