-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add "whole SDK" validation test #69928
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
base: main
Are you sure you want to change the base?
Conversation
@swift-ci please test |
Testing with Swift CI's installed Swift 5.7 found additional source-breaking changes compared to my local development environment, which uses Swift 5.9.
This is a fairly expensive test even with a limited number of modules, but might still be worthwhile. |
1bbfd9a
to
c33d7df
Compare
@swift-ci please smoke test |
Retesting with a lot more modules (i.e. most of the contents of /System/Library/Frameworks) to see how long it takes. |
Crashed. Wondering if it’s consistent. @swift-ci please smoke test macOS platform |
@swift-ci please smoke test macOS platform |
The crash during attribute processing that I'm looking at occurs only in CI. I now know that it affects
Certainly plenty of juicy attributes there for it to choke on. I'll try disabling StoreKit for now. |
@swift-ci please smoke test macOS platform |
CI found a large number of additional "IUO became ordinary Optional" issues that I don't see locally, even when I build an Intel compiler and run it through Rosetta. I may need to try this test on an actual Intel Mac when I return from the break.
Nearly nine minutes. The specific timings for the three jobs (baseline, just-built, comparison) are:
Some possible strategies here:
|
@swift-ci smoke test |
The crash relates to a use of I've fixed the unknown attribute crash in the general case, added an alias for the specific case of @swift-ci please smoke test |
lol, don't write too much in a swift-ci comment. |
@swift-ci please smoke test |
This test compares two API digests of large chunks of the installed SDK—one from the toolchain’s API digester, one from the just-built API digester—and flags any changes in behavior that would affect source compatibility.
Some of these may be actual regressions!
Trying to gather information on a failure occurring in CI.
The diagnostic consumers for swift-api-digester -diagnose-sdk were being set up after JSON files were read in, so errors in those files were silently dropped. In at least one case this led to a crash with no hint about what was happening. Set up the diagnostic consumer before doing any serious work to avoid this problem. Fixing this required me to make `newCompilerInstance()` copy diagnostic consumers to the new instance’s diagnostic engine, since compiler instances were now being created after the consumers were added instead of before. I also had to make FilteringDiagnosticConsumer filter out clang warnings, remarks, and notes since those were now being emitted early enough to register in the digester.
The API digester represents unknown attributes as DAK_Count, but passing this value to the `is{Adding,Removing}Breaking{API,ABI}()` functions is not permitted. On some platforms this would cause a crash; on others it hit unreachable code which happened to end up working. Skip these unknown attributes during comparisons to avoid this problem.
Swift 5.7’s API digester supported the unofficial @_backDeploy attribute, writing it to digests under the name “BackDeploy”, but by the time it the proposal was accepted, the spelling in source code was @backDeployed and the spelling in digests became “BackDeployed”. Add a special case to the new digester to accept the old spelling. This should fix an issue seen in Swift CI where the WholeSDK API digester test couldn’t process the StoreKit framework.
Since the API digester is designed to tolerate them anyway.
The IUO-ness of imported declarations is not actually computed by IsImplicitlyUnwrappedOptionalRequest. Instead, ClangImporter manually sets the bit to `true` after the declaration’s type is imported and expects IsImplicitlyUnwrappedOptionalRequest to always set it to `false` for all other imported declarations. Normally, declaration types are imported greedily as soon as the declaration is created. However, a ClangImporter refactoring in #61026 deferred the import of a VarDecl’s type, and therefore the setting of its IUO bit, until the first time InterfaceTypeRequest is evaluated. It turns out that there is nothing to guarantee that InterfaceTypeRequest will be evaluated before IsImplicitlyUnwrappedOptionalRequest, so if isImplicitlyUnwrappedOptional() was fetched before getInterfaceType() was called, it would return an incorrect result. The only known client that accesses the information in this order is the API digester, but in theory any part of the compiler could fall into this trap. Force the evaluation of InterfaceTypeRequest during IsImplicitlyUnwrappedOptionalRequest when necessary to compute the IUO bit for an imported VarDecl, and add a test to prove that this fixes the observed bug in the API digester.
c4f63e1
to
613bdc2
Compare
This test compares two API digests of large chunks of the installed SDK—one from the toolchain’s API digester, one from the just-built API digester—and flags any changes in behavior that would affect source compatibility.
I'm currently trying to evaluate its feasibility; I'm hoping we can run it on every pull request.
Thanks to @xymus for suggesting we generate a baseline at test time instead of including one in the test inputs, and @nkcsgexi for help with using the digester.