MobileNativeFoundation / bluepill

Bluepill is a reliable iOS testing tool that runs UI tests using multiple simulators on a single machine
BSD 2-Clause "Simplified" License
3.19k stars 232 forks source link

Xcode 12.2 support #459

Closed ravimandala closed 3 years ago

ravimandala commented 4 years ago

Officially support Xcode 12.2 whose beta#2 is available right now. \cc @RainNapper @ob

mcstoufer commented 3 years ago

+1 on this. Under Catalina/Xcode 12/iOS 14, bluepill won't even come up.

bluepill --xctestrun-path /Users/vn50v8w/Library/Developer/Xcode/DerivedData/XXX-gvsecbrvsntufqalpwmusjzuwuns/Build/Products/XXX_AppSharedDefault_iphonesimulator14.1-x86_64.xctestrun \
-o ./bluepill-build/ \
-n 6 \
-L  \
-r  'iOS 14.1' \
--unsafe-skip-xcode-version-check \
-a /Users/vn50v8w/Library/Developer/Xcode/DerivedData/XXX-gvsecbrvsntufqalpwmusjzuwuns/Build/Products/Debug-iphonesimulator/XXX.app

yields...

{94882} 20201102.094140 [  INFO  ] (BLUEPILL) Using xctestrun configuration
2020-11-02 09:41:40.736 bluepill[94882:22030218] -[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x7fc350c04570
2020-11-02 09:41:40.736 bluepill[94882:22030218] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x7fc350c04570'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff350cdb57 __exceptionPreprocess + 250
    1   libobjc.A.dylib                     0x00007fff6df195bf objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff3514cbe7 -[NSObject(NSObject) __retain_OA] + 0
    3   CoreFoundation                      0x00007fff350323bb ___forwarding___ + 1427
    4   CoreFoundation                      0x00007fff35031d98 _CF_forwarding_prep_0 + 120
    5   bluepill                            0x000000010be95d5f +[BPXCTestFile BPXCTestFileFromDictionary:withTestRoot:andXcodePath:andError:] + 107
    6   bluepill                            0x000000010be82003 +[BPApp testsFromXCTestRunDict:andXCTestRunPath:andXcodePath:withError:] + 574
    7   bluepill                            0x000000010be825bb +[BPApp appWithConfig:withError:] + 1049
    8   bluepill                            0x000000010be79639 main + 971
    9   libdyld.dylib                       0x00007fff6f0c1cc9 start + 1
    10  ???                                 0x000000000000000d 0x0 + 13
)

Somewhere we changed test info from an array to a dict. Worth investigating.

ravimandala commented 3 years ago

Looking into this.

ob commented 3 years ago

@mcstoufer can you share the XXX_AppSharedDefault_iphonesimulator14.1-x86_64.xctestrun file?

carlocab commented 3 years ago

FYI, I think the lack of Xcode 12.2 support is keeping Bluepill 5.4.2 from being upgraded on Homebrew: https://github.com/Homebrew/homebrew-core/pull/66592

chenxiao0228 commented 3 years ago

@carlocab the homebrew-core issue seems different from this one.

@mcstoufer it seems Bluepill wants a dictionary from the xctestrun file for a field but instead it got a NSArray. Like @ob mentioned would you be able to share the xctestrun file so we can find the root cause?

carlocab commented 3 years ago

@chenxiao0228 I don't see the difference, I'm afraid. Do you mind elaborating a little?

ob commented 3 years ago

I think what @chenxiao0228 means is that the error in the Homebrew CI run is:

error: The linked framework 'CoreSimulator.framework' is missing one or more architectures required by this target: arm64. (in target 'bp' from project 'bp')
error: The linked framework 'CoreSimulator.framework' is missing one or more architectures required by this target: arm64. (in target 'bplib' from project 'bp')

which sounds like the Simulators installed on that machine have been stripped of the arm64 target architecture (which is what real iPhones use). We can work around that here by making sure we only build for x86_64 since we are only targeting the Simulators, although with the new M1 based machines it's unclear how this will work out...

carlocab commented 3 years ago

@ob Thank you for the explanation. It seems like this

We can work around that here by making sure we only build for x86_64

might help fix the build failure over at Homebrew. I'm not too familiar with bluepill; if you have a quick explanation of how to do this I'd appreciate it. Otherwise, I'll try to figure it out.

chenxiao0228 commented 3 years ago

I have skipped 12.2 and looking at 12.3 now. There are several issues I have found so far. Xcode 12.3 builds for Apple Silicon arm64 but CoreSimulator only has arm64e slice. We will have to disable the arm64 target. Then I also saw some issues with nm. Will get to it soon.

chenxiao0228 commented 3 years ago

Fixed in v5.6.0

carlocab commented 3 years ago

5.6.0 seems to have also fixed the Homebrew build. Thanks!