Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test bridge crashes after running tests #10

Closed
jamiebullock opened this issue Sep 5, 2018 · 3 comments
Closed

Test bridge crashes after running tests #10

jamiebullock opened this issue Sep 5, 2018 · 3 comments
Assignees

Comments

@jamiebullock
Copy link

Hi. Great work with gmock-xcode!

I am experiencing a crash with a basic "hello world" test project...

Steps to reproduce:

  • Create a new empty Xcode project
  • Add a macOS Unit Testing Bundle Target
  • Add GoogleMock.xcodeproj as a subproject
  • Copy Test.cpp to the new project and add it to the testing target
  • Add GoogleMock to the Target Dependencies and Link With Libraries in Build Phases
  • Product -> Test

Behaviour:

  • The test runs successfully and passes
  • The test bridge crashes in GMXCTestBridge.mm:267 with error:

Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)

Call stack:

Thread 1 Queue : com.apple.main-thread (serial)
#0	0x00007fff5e34b682 in _mapStrHash(_NXMapTable*, void const*) ()
#1	0x00007fff5e34b5c7 in _NXMapMember(_NXMapTable*, void const*, void**) ()
#2	0x00007fff5e34b58d in NXMapGet ()
#3	0x00007fff5e35143d in getClass_impl(char const*) ()
#4	0x00007fff5e3513ed in getClass(char const*) ()
#5	0x00007fff5e3570af in objc_allocateClassPair ()
#6	0x0000000106b891b4 in ::+[GoogleMockXCTestBridge initialize]() at /Users/jamie/Documents/Noiiz/git/noiiz-plugin-module/Tests/External/gmock-xcode/GoogleMock/Classes/GMXCTestBridge.mm:267
#7	0x00007fff5e35e2de in CALLING_SOME_+initialize_METHOD ()
#8	0x00007fff5e34f3c9 in _class_initialize ()
#9	0x00007fff5e34ee8f in lookUpImpOrForward ()
#10	0x00007fff5e34e914 in _objc_msgSend_uncached ()
#11	0x00007fff370f9a20 in -[__NSSetM addObject:] ()
#12	0x00000001003d0270 in +[XCTestCase(RuntimeUtilities) allSubclasses] ()
#13	0x000000010036714d in +[XCTestSuite _suiteForBundleCache] ()
#14	0x00000001003694e4 in -[XCTestSuite _initWithTestConfiguration:] ()
#15	0x000000010036a2c8 in +[XCTestSuite testSuiteForTestConfiguration:] ()
#16	0x00000001003e606f in -[XCTTestRunSession runTestsAndReturnError:] ()
#17	0x000000010034f865 in -[XCTestDriver runTestsAndReturnError:] ()
#18	0x00000001003d10f3 in _XCTestMain ()
#19	0x0000000100002155 in main ()
#20	0x00007fff5ef75015 in start ()
#21	0x00007fff5ef75015 in start ()
@jamiebullock
Copy link
Author

Note that I can successfully run the test included in the GoogleMock.xcodeproj, the problem only occurs when I add GoogleMock to my own project. I therefore suspect this may be an issue with compiler settings. Currently I am just using the Xcode defaults.

@macmade
Copy link
Owner

macmade commented Sep 5, 2018

Sorry you ran into issues.

What kind of target are you testing?
Not sure I understand your 4th point:

Copy Test.cpp to the new project and add it to the testing target

Can you share your example project?

@macmade macmade self-assigned this Sep 5, 2018
@jamiebullock
Copy link
Author

Thanks for the quick answer. It seems it was my error here as I didn't add the test bundle to Test action in the scheme for my my target. So either the tests didn't have an associated target or they had the test bundle itself as a target.

It might be worth adding to the README that the test bundle needs to be added in the scheme manager as shown below, for those who are not so familiar with setting up tests.

screen shot 2018-09-06 at 09 49 02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants