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

[SR-10144] XCTest asynchronous predicate tests do not function on Windows #353

Closed
compnerd opened this issue Mar 21, 2019 · 5 comments
Closed

Comments

@compnerd
Copy link
Collaborator

@compnerd compnerd commented Mar 21, 2019

Previous ID SR-10144
Radar None
Original Reporter @compnerd
Type Bug
Status Closed
Resolution Cannot Reproduce
Additional Detail from JIRA
Votes 0
Component/s XCTest
Labels Bug, Android, Linux, Windows
Assignee @compnerd
Priority Medium

md5: 3ae7991a12d91bc395c930ce5e3716aa

Issue Description:

The test harness sets up the runloop to the current runloop which is not the actual runloop that the test will execute on which results in the test failing. Using the maion loop rather than the current runloop allows the test to pass.

@compnerd
Copy link
Collaborator Author

@compnerd compnerd commented Mar 21, 2019

@stmontgomery
Copy link
Contributor

@stmontgomery stmontgomery commented Mar 21, 2019

I think you may be correct that there is an unintentional behavioral difference here compared to the ObjC / Darwin XCTest framework. It was intentional for XCTNSPredicateExpectation to call `RunLoop.current` in order to get its run loop to use, but the timing of when it obtains that run loop looks wrong. In ObjC / Darwin XCTest, it calls `RunLoop.current` while on a private queue which is the analogue of `XCTWaiter.subsystemQueue` here. But in Corelibs XCTest, it gets the current run loop at object initialization, which is not on `XCTWaiter.subsystemQueue`.

So if my reading here is correct, it may indeed be using the wrong run loop. Although if this is the case, the correct run loop may not actually be not `.main` either, but the run loop corresponding to the thread for `XCTWaiter.subsystemQueue`.

Seems like the fix would be for XCTNSPredicateExpectation to lazily populate its `runLoop` property in `didBeginWaiting()` instead of setting it during init.

@stmontgomery
Copy link
Contributor

@stmontgomery stmontgomery commented Mar 21, 2019

@compnerd would you like to take on this fix, or want me to? I may not get to it very soon I'm afraid.

@compnerd
Copy link
Collaborator Author

@compnerd compnerd commented Mar 22, 2019

Sure, if you won't get to it soon, I may try my hand at it.

@compnerd
Copy link
Collaborator Author

@compnerd compnerd commented Oct 2, 2020

This is no longer the case, with fixes for Python 3, I am seeing 100% test coverage on Windows as well.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
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