Skip to content

Tests: Add integration tests for @_backDeploy. #41791

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

Merged

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Mar 11, 2022

Add integration tests for @_backDeploy designed to verify that use of declarations annotated with @_backDeploy behave as expected when running a client binary on an older OS that does not have the back deployed APIs. Verification is performed the following way:

  1. Build a helper framework with the availability macro BackDeploy 1.0 defined to an OS version before Swift ABI stability and version 2.0 of that macro defined to an OS version after Swift ABI stability. Note that stradling ABI stability is not a necessary requirement of this test; it's just convenient to use OS versions that correspond to existing lit substitutions.
  2. Build the client executable with a deployment target set to the same OS version as BackDeploy 2.0.
  3. Run the client executable, verifying that the copies of the functions in the framework are used (verified by runtime logic that compares the results of #dsohandle).
  4. Build a new copy of the helper framework, this time with BackDeploy 2.0 defined to a distant future OS version.
  5. Build a new copy of the client executable against the new framework and the deployment target set to the same OS version as BackDeploy 1.0.
  6. Run the new executable, verifying via #dsohandle that client copies of the APIs are used.
  7. Re-build the framework in place, this time stripping out the definitions of the back deployed APIs entirely.
  8. Re-run the unmodified executable, with the same expectations as in (6). However, this time we're also verifying that the executable can run even without the original API symbols present in the linked dylib.

@tshortli tshortli force-pushed the back-deploy-attr-integration-tests branch from 0459e78 to 24002be Compare March 16, 2022 00:10
@tshortli tshortli marked this pull request as ready for review March 16, 2022 00:19
@tshortli tshortli force-pushed the back-deploy-attr-integration-tests branch 2 times, most recently from 018f3f3 to d2a9659 Compare March 16, 2022 00:30
… declarations annotated with @_backDeploy behave as expected when running a client binary on an older OS that does not have the back deployed APIs.

APIs with a variety of function signatures (inout parameters, throwing, generic, existential parameters and return values, etc.) are exercised to verify SILGen for these cases.
@tshortli tshortli force-pushed the back-deploy-attr-integration-tests branch from d2a9659 to c09df49 Compare March 16, 2022 07:33
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli
Copy link
Contributor Author

@swift-ci please test macOS

@tshortli tshortli merged commit 3aa4c0e into swiftlang:main Mar 17, 2022
@tshortli tshortli deleted the back-deploy-attr-integration-tests branch March 29, 2022 21:23
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.

1 participant