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

Merge main into release/6.0 #1217

Merged
merged 9 commits into from
May 3, 2024

Conversation

The scheduler isn’t actually being used yet but it’s complex and generic enough that it’s possible to review it by itself.
This introduces an abstraction layer around `IndexStoreDB` (yes, I known another one …) that consults the underlying `IndexStoreDB` and then checks whether the entries are up-to-date with respect to some `IndexCheckLevel`. Requests can specify how picky they want to be about declaring results from the index out-of-date.

The default choice right now is to not include index entries from source files that have been deleted (because those are definitely from lingering unit files) but include results even if the source file has been modified after it was last indexed. We do include results from files that have been modified since they were last indexed because: When a file gets modified, it's likely that some of the line:column locations in it are still correct – eg. if only one line is modified and if lines are inserted/deleted all locations above are still correct. For locations that are out of date, showing stale results is one of the best ways of communicating to the user that the index is out-of-date and that they need to rebuild. We might want to reconsider this default when we have background indexing.

rdar://125230833
rdar://126622963
Filter index entries for deleted source files
Add a task scheduler for background indexing and preparation
Creating `Process` on Amazon Linux fails with: `workingDirectory is not supported in this platform`. Instead of setting a working directory, pass the working directory as `-C` to `git` when creating a `SwiftPMDependencyProject`.
…ndex

When the semantic index is out-of-date, we currently purely rely on the syntactic index to discover tests and completely ignore data from the semantic index. This may lead to confusing behavior. For example if you have

```
class MightInheritFromXCTestCaseOrNot {}

class MyClass: MightInheritFromXCTestCaseOrNot {
  func testStuff() {}
}
```

Then we don’t return any tests when the semantic index is up-to-date. But once the file is modified (either on disk or in-memory), we purely rely on the syntactic index, which reports `testStuff` as a test method. After a build / background indexing finishes, the test method disappears again.

We can mitigate this problem as follows: If we have stale semantic index data for the test file, for every test method found by the syntactic index, check if we have an entry for this method in the semantic index. If we do, but that entry is not marked as a test class/method, we know that the semantic index knows about this method but decided that it’s not a test method for some reason. So we should ignore it.

rdar://126492948
Don’t use `workingDirectory` when creating a `SwiftPMDependencyProject`
…ic-tests-based-on-outdated-index

Enhance syntactic test discovery with information from the semantic index
@ahoppen ahoppen requested a review from bnbarham May 3, 2024 14:27
@ahoppen ahoppen requested a review from benlangmuir as a code owner May 3, 2024 14:27
@ahoppen
Copy link
Member Author

ahoppen commented May 3, 2024

@swift-ci Please test

@ahoppen ahoppen merged commit fe44f49 into swiftlang:release/6.0 May 3, 2024
3 checks passed
@ahoppen ahoppen deleted the 6.0/merge-main-2024-05-03 branch May 3, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants